With setOrigin
you set the origin
of the Sprite
, which is responsible for rotation
and scaling
. But it does not affect the position
.
This means, that if you set the origin
to P(width/2,height/2)
and you rotate your Sprite
it will rotate arround his center. If you set the origin
to the left lower corner P(0,0)
it will rotate arround that corner.
The position
instead is always the left, lower corner and it is not affected by the origin
.
If you want to hold a position
as center point you need to recalculate the left lower corner out of that:
sprite.setPosition(posVector.x-sprite.getWidth()/2, posVector.y-sprite.getHeight()/2);
Note, that the origin
is relative to the Sprite
s position
. So P(0,0) is the left lower corner and P(width,height) is the right upper corner.