Jump to content
  • Advertisement

Archived

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

Leyder Dylan

Vector : a trigonometric problem

This topic is 5924 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!