ok ill first draw a diagram…
0 degrees
|
|
|
| (x2,y2)
| (x,y)
|_______________ 90 degrees
so up there i have two known points, and i want to find the angle at which (x,y) must be rotated to be facing (x2,y2). this is for my car racing game, im trying to line up (just the human) car at to the finish line. what im doing is finding the mid point of the finish/starting line, then i give it an offset (so thats is somewhere before the starting line) then i calculate the angle to the point on the starting line where the car will be perdendicular to.
i was using something like the rule cos(theta) = y/x, but for some reason that doesnt really work to great. it works if i calculate the angle the car must travel to hit the midpoint, but if i try and move that point, then for some reason it doesnt give me the expected results.
thanks for any help :)