views:

298

answers:

1

Hello,

I am trying to change my Sprite anchor point so that I can rotate over a 0.0f,0.0f anchorpoint. At first my object is rotation at the default anchor point (0.5f,0.5f). However later on I need it to rotate over a 0.0,0.0 AnchorPoint.

The problem is I cannot change the anchor point and change the position accordingly, so it stays on the same position, without the object appearing to quickly move and reposition to its original point.

Is there a way I can set the anchor point and the position of my Sprite at once, without it moving at all?. Thank you.

-Oscar

+1  A: 

This is a good question, and I don't know the full answer yet.

As you may have noticed, the anchorPoint cannot be changed without affecting scale and rotation.

For scaled sprites:

You have to simultaneously change the anchorPoint and position of your sprite. See this question for a hint

For rotated sprites:

Intuition says you would need to simultaneously change anchorPoint, rotation, and position. (I have no idea how to compute this.)

NOTE: I'm still learning graphics programming, so I'm not 100% able to compute this stuff yet.

bentford