Go to the source code of this file.
◆ EstimateCollisionResponse()
This function estimates the contact impulses and body velocity changes as a result of a collision. It can be used in the ContactListener::OnContactAdded to determine the strength of the collision to e.g. play a sound or trigger a particle system. This function is accurate when two bodies collide but will not be accurate when more than 2 bodies collide at the same time as it does not know about these other collisions.
- Parameters
-
inBody1 | Colliding body 1 |
inBody2 | Colliding body 2 |
inManifold | The collision manifold |
outResult | A structure that contains the estimated contact and friction impulses and the resulting body velocities |
inCombinedFriction | The combined friction of body 1 and body 2 (see ContactSettings::mCombinedFriction) |
inCombinedRestitution | The combined restitution of body 1 and body 2 (see ContactSettings::mCombinedRestitution) |
inMinVelocityForRestitution | Minimal velocity required for restitution to be applied (see PhysicsSettings::mMinVelocityForRestitution) |
inNumIterations | Number of iterations to use for the impulse estimation (see PhysicsSettings::mNumVelocitySteps, note you can probably use a lower number for a decent estimate). If you set the number of iterations to 1 then no friction will be calculated. |