I got a sprite, I know the position, and the rectangle behind. I want to get the location behind the sprite, I know the offset.
My point would be like:
Point p=new Point(sprite.getX()-offset,sprite.getY()-sprite.getHeight()/2);
If I rotate my sprite around its center origin, I want to get the new location of that point.
An image that will explain better:
You need to provide the coordinates of the rotation center (the point which remains fixed).
X' = (X - Xc) * cos(A) - (Y - Yc) * sin(A) + Xc
Y' = (Y - Yc) * cos(A) + (X - Xc) * sin(A) + Yc
And it would also be nice to tell us what does not work, as you don't give a clue...
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