Sign in to follow this  

spherical coordinates

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

hi all.. i'm developing a game that is going to involve playing on the surface of an invisible sphere, surrounding an object in the center. i've had much trouble coming up with proper mathematics to do this, using spherical coordinates isn't quite working out well enough. i think what i need is some way of computing the plane along the tangent of a point on the surface of the sphere (the 'current position') and computing the arc of motion, then using the points along that arc (recomputing if the velocity direction changes if so required at each stage)... but i'm a bit hazy on how to do this exactly.. any pointers, or some other method of accomplishing the same thing? thanks chris.

Share this post


Link to post
Share on other sites
Exactly what you should do depends entirely on how you are implementing your system and how physically accurate you want it to be. If you have a look at lagrangian mechanics you'll see how to calculate the motion of a constrained particle (eg a bead on a wire). If you want to handle linear velocities, then (assuming the distance moved per frame is small compared to the sphere) you could simply consider the motion as linear and project it down onto the sphere. This works because a sphere is locally flat (this doesn't need real physics). If you want the player to be attached to the sphere by gravity, and you have a physics simulation, then you could have a genuine gravitational field attracting the player. None of this is mathematically that complex. I'm guessing the vector projecting method should be the simplest. You are simply storing cartesian coordinates in the normal way, with a coordinate system centred on the sphere, then normalising them to the spheres radius.
Hope this helps,

Dan

Share this post


Link to post
Share on other sites

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

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