Jump to content
  • Advertisement


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



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

Direction? I'm not sure what exactly you mean by that, if you mean the x, y and z components of the vector then you do it like this. If you have a vector defined by two angles and a magnitude then:

x = v.cos(phi).sin(theta)
y = v.sin(phi)
z = v.cos(phi).cos(theta)

Where phi is the angle between the x/z plane and the vector, theta is the angle between the vector and the x-axis and v is the magnitude of the vector.

These calculations assume the +z-axis runs towards the center of the screen, the +y-axis runs up the screen and the +x-axis runs to the right of the screen.

If you mean how do you calculate the magnitude of the vector and the angles it's orientated at. If you have the vector defined as x,y,z. Then do this:

v = sqrt(x.x+y.y+z.z)
theta = tan-1(z/x)
phi = sin-1(y/v)

Using the same situation as above.

I think that's right. Hope it helps.

Edited by - Chris F on June 17, 2000 12:34:39 AM

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!