Point Rotation Help

Started by
3 comments, last by DefCom 22 years, 1 month ago
Quick Brief: I am making an overhead car game (how original) and i am using a point on each corner of the car to test for collision. The idea was to rotate the point with the rotation of the car. The problem: When I rotate the points using Xnew=(X*(cos theta))-(Y*(sin theta)) Ynew=(X*(sin theta))+(Y*(cos theta)) The point spirals into the center! the rotation i am after is 22.5 degrees an i am converting to radians using rad=deg*(pi/180) Any help will be much appriciated,Thankyou
Advertisement
Your formulas are good. I think it''s due to rounding error : by applying multiple rotation each followed by a rounding, the dimensions of your car are modified (shrinking). You should keep somewhere the actual angle of rotation of your car and apply the rotation to the "angle 0" or original car at each time.

hope so...
I know that I don't know nothing... Operation Ivy
hi

well your formulae are correct. make sure you are not performing rotations on already rotated points. ie. keep an array of ORIGINAL points which never alter. when it comes to rotation, base your calculations on the original array and store the result in the new array.
:o)
Thanks i''ll try that, I did try after 360 rotation had happend to reset the starting points, but it didnt change the spiral, but yes i was rotating rotated points


I am now in/de-creasing the angle and the applying it the initial Point coords and is working fine, Thank again.


This topic is closed to new replies.

Advertisement