Collision callback that affects collision response
Posted: Sat Feb 26, 2011 12:59 am
I would like to set up a simulation as follows:
A streetlamp is a static rigid body (mass==0) comprised of a compound of boxes and cylinders.
A car is a compound of convex hulls.
A car collides with a street lamp at ~40 mph.
I would like the streetlamp to vanish and be replaced with a dynamic fractured streetlamp that has an initial velocity consistent with the collsion. By iterating through manifolds and contact points this much is easy. I just remove the static rigid body and replace it with a set of 'pieces' and use the impulse to help set their initial velocities.
However the car has already responded to the initial collision by having an enormous impulse applied to it in the opposite of its velocity. This causes its motion to completely halt. I would like it to continue through the the streetlamp with only a small degradation in velocity, or none at all. This is similar to how many games operate, e.g. GTA IV.
I tried to do this while iterating through the contact points, by applying an impulse (the one from each contact point) to the car in the direction of its penetration into the streetlamp (using the contact normal). However the car still reacts strongly to the collision (perhaps less strongly than before). I've tried both the position A and position B, using the normal and negative normal, with varying results. Is this the correct way to proceed?
A streetlamp is a static rigid body (mass==0) comprised of a compound of boxes and cylinders.
A car is a compound of convex hulls.
A car collides with a street lamp at ~40 mph.
I would like the streetlamp to vanish and be replaced with a dynamic fractured streetlamp that has an initial velocity consistent with the collsion. By iterating through manifolds and contact points this much is easy. I just remove the static rigid body and replace it with a set of 'pieces' and use the impulse to help set their initial velocities.
However the car has already responded to the initial collision by having an enormous impulse applied to it in the opposite of its velocity. This causes its motion to completely halt. I would like it to continue through the the streetlamp with only a small degradation in velocity, or none at all. This is similar to how many games operate, e.g. GTA IV.
I tried to do this while iterating through the contact points, by applying an impulse (the one from each contact point) to the car in the direction of its penetration into the streetlamp (using the contact normal). However the car still reacts strongly to the collision (perhaps less strongly than before). I've tried both the position A and position B, using the normal and negative normal, with varying results. Is this the correct way to proceed?