Jump to content
  • Advertisement
Sign in to follow this  
sasquach

Points on a Sphere and Cylinder

This topic is 4063 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
Advertisement
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
Sign in to follow this  

  • 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!