Archived

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

Leyder Dylan

Vector : a trigonometric problem

Recommended Posts

Hi, I''d like to calcul the traject for my bullet but I''ve a trigonometric problem and it''s so far for me, about 4 years ... Here''s my example : img src="http://ibelgique.ifrance.com/Slug-Production/Images/Vector.jpg"> I''ve a vector who begins at X, Y ==> (0,0) His length is : 10 On the example, if the angle is equal to 0°, the vector''s direction will be X,Y ==> (0,10). But my question is, where will be the vector if the angle equals 30° ??? So, I must consider this : - The angle - The lenght of my vector What''s the formul for calculating this ? It''s possible to apply this formule with a example. I''m gonna take this example. 1) - The anle = 0° - The vector''s lenght = 10 2) - The angle = 90° - The vector''s lenght = 10 ==> In this case, X will be equal to - 10 and Y to 0 ======================== Leyder Dylan http://ibelgique.ifrance.com/Slug-Production/

Share this post


Link to post
Share on other sites
X = cos(30) * 10;
Y = sin(30) * 10;

but remember that that the default c/c++ math lib works with radians and not degrees as opengl does. so you first have to transform you degree values to radians... you can do that by multiplying the degree by (PI/180)

//ziruz

------------------------------------------------------------
XL is comming soon @ http://ziruz.cjb.net/

Share this post


Link to post
Share on other sites