I'm learning the libgdx engine and i got difficulties understanding the difference of .setOrigin and .setPosition . Take the demo libgdx creates. What is the difference if i put 1f,1f on origin and what on position of the texture this demo uses?
The Origin is used for Scaling and Rotating transforms. For example, if you put the origin at the Center of your sprite (width/2, height/2). When you rotate it, it will rotate around its center.
The position is the bottom-left corner of your sprite in world coordinates.
What is the difference if i put 1f,1f on origin and what on position of the texture this demo uses?
On origin it won't make any difference if you don't rotate or scale the sprite. On position, it will change where the sprite is drawn.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With