Hi. I'm not too sure about the technical words since I speak french but I have a rectangle triangle (with a 90degree angle).
I know both sides (x,y) so to get the hypothenuse, I did this:
float hyp = sqrt((difX * difX) + (difY * difY));
Now, to get the angle I want, I did this:
float rocketAngle = acos(difX/hyp); // difX/hyp should give me the cos of my angle.
I don't understand why it doesn't work. I apply a rotation to my missile with the angle of rocketAngle and it stays straight. My rotation code works if I test it with a static number.
This is done with OpenGL btw.
I know both sides (x,y) so to get the hypothenuse, I did this:
float hyp = sqrt((difX * difX) + (difY * difY));
Now, to get the angle I want, I did this:
float rocketAngle = acos(difX/hyp); // difX/hyp should give me the cos of my angle.
I don't understand why it doesn't work. I apply a rotation to my missile with the angle of rocketAngle and it stays straight. My rotation code works if I test it with a static number.
This is done with OpenGL btw.