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

## Recommended Posts

xraven13    107
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
nGamer    184
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
xraven13    107
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..