# Points on a Sphere and Cylinder

This topic is 4156 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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.

1. 1
2. 2
Rutin
25
3. 3
4. 4
5. 5

• 10
• 10
• 13
• 20
• 14
• ### Forum Statistics

• Total Topics
632949
• Total Posts
3009368
• ### Who's Online (See full list)

There are no registered users currently online

×