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

This topic is 3050 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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 on other sites
That doesn't work because sprite is rotated...;) That was first thing i tried :p..

And btw my origin is equal to :
Origin.x = width/2;
Origin.y = height/2;
It doesn't matter but..

• 36
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631359
• Total Posts
2999538
×