Sign in to follow this  
Win32

Collision Tunneling / Ghosting

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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