# Handling Penetration

1. Oct 5, 2007

### bkenwright

Hi all,
I'm currently trying to write a simple physics demo with cubes, and am looking for the best way to handle penetration.

One method I was looking at is to back-track the collision detection till we find the point of intersection within some limit.. i.e.

collision at dt, so we step back dt/2 again and again till we have a hit within some limit...the only problem I'm having is...what if you have an object hitting the ground at dt of 0...doen's this mean our time step value is 0?...so the object increment is 0...hmmm.

Any ideas would be great.

Thanx

Ben

=)

2. Oct 5, 2007

### Loren Booda

A comprehensible description would be just as nice.

What kind of cubes? Polynomial?

What is penetrating what?

Is dt a differential or measurement?

Etc.

What is the problem as presented by the instructor?

3. Oct 11, 2007

### bkenwright

Well the case I'm trying to deal with is penetration on a general scale. For example, lets say you have a cube bouncing on a plane, and you have large time steps....and you use eulers integration...and just do each vertex point being below the plane to detect a collision.

Now, because the timesteps are large enough, for each time step when a collision is detected, there will be a small error where the cube penetrates the plane.

To solve this, I could back track the simulation to where the collision detection is just on the surface...ie.

store values
update dt (integrate)
while (penetrating)
{
restore values
dt = dt/2
update dt (use half dt)
}

But using this method, if the object is really close to the surface...then for any timestep greater than 0 its going to penetrate the surface due to gravity...so this will result in the above method reduce dt to almost 0...and hence its updates will fail :-/

Thanx for any help on this.

Ben

:)