Jump to content
  • Advertisement
Sign in to follow this  
xSKOTTIEx

unit vector?

This topic is 5203 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!