Gio,
I have a question regarding maintaining an offset for a sprite when the scene object it is attached to is rotated.
For example, if you have a gun attached to say a boat, and the gun is at the boats bow (front).
When you set up the boat object, the gun sprite is added with an offset of for example {x:0, y:-20}.
Now when the scene object is rotaed 180 degrees, the gun is now at the rear of the boat. That is, the offset is constant {0,-20}, and not updated when the scene object rotates
I know how to do this manually in the update routine via resetting the offset position based on the sine and cosine of the rotation of the scene object.
My question is - is there a parameter I can set on initialization, or some method to call so that the sprite offset remains the same relative to the scene objects rotation ?
In the above example, the initial offset would be {0,-20}
When the boat is rotated 180 degrees, the offset should now be {0,20}
new x offset = -20 * sin(180) = 0
new y offset = -20 * cos(180) = 20
And the gun still appears at the bow of the boat.
As usual, any help you can provide would be appreciated.
cheers,
Shri