particle sim and collision question (cylinders)


I’m implementing a particle simulation, and I’m handling collisions with planes. I want to be able to handle cylinders as well.

If I use gluCylinder(), is there a way to access the normals at a given point on the cylinder? Or, do I need to generate my own cylinder code and handle it myself?


I think you don’t need to know the generated normal by gluCylinder. If you know the orientation, length, and radius of your cylinder, you can calculate the normal yourself (by this way you will have the true normal at the collision point, not an approximation given by the resulting tessellation).

For the side of the cylinder the collision test is essentially verify if your point is inside a circle (a cylinder can be viewed as a stack of circles aligned perpendicular of the orientation or axe). Knowing the orientation, having calculated the intersection point, you can calculate the true normal.