Advertisement

Collision Tunneling / Ghosting

Started by July 07, 2008 11:35 PM
1 comment, last by FluxCapacitor 16 years, 7 months ago
I've done plenty of reading on the subject, yet I haven't come across any answer to how to avoid it in the first place? It's probably obvious, but for the life of me I can't wrap my head around it.
Imagine you've got a sphere with radius R. It's moving from position A to position B.
To make sure you find ALL collisions for this movement, you need to construct a new shape that is the union of the shape of the sphere at every point from A to B. In this case, that shape is a capsule (i.e. A cylinder capped with hemispheres). The radius of the capsule is the same as the sphere, and the end-points of the capsule are at A and B.

Check out swept collision detection
Advertisement
The only surefire way to prevent tunneling is to use some sort of continuous collision detection. However, unless you're doing something fairly out of the ordinary, tunneling is really more of a theoretical problem than a practical one. I think most people just clamp their object velocities to a reasonable level and take small fixed timesteps, in which case tunneling isn't too much of an issue. If you do have a few fast-moving objects, depending on how accurate you need your simulation to be, you could perform approximate collision detection using raycasts rather than more complicated continuous geometry checks.

This topic is closed to new replies.

Advertisement