Sign in to follow this  

Points on a Sphere and Cylinder

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

Here is what I'm trying to do. I need to do collision detection in my game but I'm having trouble finding out the points to use or even how to figure where those points are. I'm using gluSolidSphere(3.0, 10, 10) for the sphere and gluSolidCylinder(.5,6,10,10) then I translate both objects away from each other. For the collision detection I was going to use basic 2D based of a cube this is why I need the points. Unless there is an easier why to do collision dectection.

Share this post


Link to post
Share on other sites
There are a number of ways you can do this. For example if you are testing bounding box and sphere/cylinder collision you have to express the sphere and cylinder using their "implicit equations" (this is an equation of the form f(x)=0). Then you sub the corner points of the bounding box into the equations and check of the result for any of the corners is less than or equal to zero, in which case there is a collision.

Or if you want to do sphere sphere collision you simply find the distance between the center of sphere1 and sphere2, and if the distance is less than or equal radius1 + radius2 there is a collision.

Now you probably want to know how to express your spheres and cylinders using thoes equations. Well you simply find thoes implicit equations and use the properties of thoes shapes to "fill them in".

My explanation may still be too high level, so If youre still unsure just ask for clarifacation.

Share this post


Link to post
Share on other sites

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