
15.3 Types of Friction 395
{
velocityFromAcc -=
body[1]->getLastFrameAcceleration() * scaledContact;
}
// If the velocity is very slow, limit the restitution.
real thisRestitution = restitution;
if (real_abs(contactVelocity.x) < velocityLimit)
{
thisRestitution = (real)0.0f;
}
// Combine the bounce velocity with the removed
// acceleration velocity.
desiredDeltaVelocity =
-contactVelocity.x
-thisRestitution * (contactVelocity.x - velocityFromAcc);
}
Ihaveplacedthisseriesofoperationsinitsownmethod:
calculateDesiredDeltaVelocity that is called as part of the calculateInternals
method, rather than have the calculations performed every time that the velocity
resol ...