• Getting forward coord based on angle
    10 replies, posted
If i have something's current coord position, and its angle in digrees, how can i get a position that is say 1 unit exactly in front of the current one based on it's angle? Thanks guys :P
2D or 3D?
2D
y = sin(angle*pi/180)+y_origin x = cos(angle*pi/180)+x_origin
Oh great, thanks! And to advance it more than 1 unit it just multiply that right?
[QUOTE=bobthe2lol;22583544]Oh great, thanks! And to advance it more than 1 unit it just multiply that right?[/QUOTE] Yeah, like this: y = sin(angle*pi/180)*length+y_origin x = cos(angle*pi/180)*length+x_origin
Also, if i have a 2 coordinate positions, and the angle of one of them, how can i get how much that angle needs to turn so that the second one is directly in front of it?
Coordinates do not have an angle. You are probably searching for the arctangent tough: turnangle = atan2(y2 - y1, x2 - x1) - currentangle Brush up a bit on your trigonometry :P
Am I right in saying that arctan is the same as tan^-1? Here in Britain we just call it inverse tan.
tan^-1 is just another way to write it. I find it weird though, since tan^-1(x) is not (tan(x))^-1, whereas tan^2(x) for example is (tan(x))^2. The arc stands for arcus and means inverse I think.)
Yeah my trig sucks lol. Thanks Zeeky
Sorry, you need to Log In to post a reply to this thread.