Sign in to follow this  
AverageJoeSSU

Moving around a 3D Point

Recommended Posts

i have an object that i want to move (translate) around a 3d point, so far i have something like this... where rot is the "rotation" from 0 to 360. is this right? Also, i want the object to rotate so that it is always facing away from the point. i suspect it will use sin and cos as well. x + (radius * (Math.cos(rot))) y + (radius * (Math.sin(rot))) z + (radius * (Math.cos(rot) + Math.sin(rot))) thanks in advance

Share this post


Link to post
Share on other sites
http://en.wikipedia.org/wiki/Spherical_coordinates

A=[0, pi]
B=[0, 2pi]

x = r * cos(B) * sin(A)
y = r * sin(B) * sin(A)
z = r * cos(A)

Also consider glRotate.

... and you'll have to figure out the rest from there.
http://www.youtube.com/watch?v=E3uYLKGQ_vQ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this