• Advertisement
Sign in to follow this  

Moving around a 3D Point

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

Share this post


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

  • Advertisement