Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rIK

X/Y Co-ords after rotation

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an image in the centre of the screen. And I have drawn the image at its centre point and can rotate the image by prssing left/right. Now I also have 2 variables which store the top centre of the object, and the bottom centre of the object. I would like to know how to calculate these exact same points (top/bottom centre of image) when the image is rotated. I am guessing a formula using Sin/Cos and the angle the car is rotated at is the order of the day, but I am at a loss and maths isn`t my strong point =( Thanks for any help.... If you need a better explanation, just say! r!K

Share this post


Link to post
Share on other sites
Advertisement
You mean like this?



+--A--+
| |
| |
| |
+--B--+




x = oldx*cos(Angle) - oldy*sin(Angle)
y = oldx*sin(Angle) + oldy*cos(Angle)

But you must be doing something like this if youre already rotating it right? Maybe not.

If you have the corner points already then the center points are just:

x = (x1+x2)/2
y = (y1+y2)/2

where (x1,y1) and (x2,y2) are the adjacent corners.

Tell me if I''ve misunderstood you.
ro

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!