SFML community forums

Help => Graphics => Topic started by: ThatOneGuyThatDoesStuff on June 22, 2021, 09:50:57 pm

Title: Scale offset
Post by: ThatOneGuyThatDoesStuff on June 22, 2021, 09:50:57 pm
Whenever I have tried to scale a sprite, it offsets down slightly. It doesn't move left or right, but it's position is lower that it should be (greater y value). I have no idea why. Would appreciate an explanation as to what I'm doing wrong.

sprite.setScale(CATAPULT_SCALING_FRACTION);
 
Title: Re: Scale offset
Post by: eXpl0it3r on June 24, 2021, 12:58:23 pm
Scaling as any other transformation happens around/from the origin.
If your origin is set to the middle of the sprite, it will expand equally in all direction.
If your origin is set to the top left corner (default), then it will scale in the bottom right direction.
Title: Re: Scale offset
Post by: ThatOneGuyThatDoesStuff on June 26, 2021, 01:49:16 pm
Scaling as any other transformation happens around/from the origin.
If your origin is set to the middle of the sprite, it will expand equally in all direction.
If your origin is set to the top left corner (default), then it will scale in the bottom right direction.

You sir, are an officer and a gentleman and a credit to your old mum and dad.