Sign in to follow this  
xraven13

Center of rotated object in space if i have origin of center and top left coordinates

Recommended Posts

Picture of problem : http://i47.tinypic.com/r2vvxd.png So x and y of sprite is top left of the sprite. Origin.x and origin.y are relative to the sprite (origin values don't change how sprite flies around and rotates) and they are center of rotation. Sprite ( ship ) is moving left,right,up, down and it also rotates around its center point (origin). What i need is the value of its center in 2D coordinate system.. I also have angle of ship... So how to get coordinates of its center if ship flies around and rotates? Thanks in advance :)

Share this post


Link to post
Share on other sites
The center point x would be its x position plus the width of the sprite divided by 2.

The center point y would be its y position plus the height of the sprite divided by 2.

int centerPointX = xPosition + (imageWidth / 2)
int centerPointY = yPosition + (imageHeight / 2)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this