Jump to content
  • Advertisement
Sign in to follow this  
xSKOTTIEx

unit vector?

This topic is 4745 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

i want my cannons in my game to recoil. im going to need the unit vector of their aim to get this. if i have their rotation (angle) how would i get a unit vector? im thinking this: tan(theta) = y / x; i could make x = 1; so tan(theta) = y which would mean the vector for that direction would be < 1, tan(theta) >.... is this a unit vector? if not, how do i find one off just an angle?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
cos(theta) = x / h
sin(theta) = y / h

Make h (the hypotenuse) 1 and you have your vector.

Share this post


Link to post
Share on other sites
oh for the love of christ.

i got an A in college calculus at virginia tech and i couldnt figure that out... wow. brain fart.

*throws away page of vector computations*

thanks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!