Game Development Reference
In the same way, impulse is a force exerted over a short period of time:
where f is force and t is time. Given the impulse required to remove the velocity and
the duration of the update, we can calculate the force required to remove the velocity.
The equation still requires a normal reaction force. This can be calculated in the
same way, but looking at the contact normal. The normal reaction force can be ap-
proximately calculated from the amount of velocity removed in the direction of the
If the desired change in velocity at the contact normal is v , then the reaction force
can be approximated as
The velocity resolution algorithm we already have involves calculating the im-
pulse needed to achieve the desired change in velocity. This impulse is initially found
in contact coordinates. Since we will be working in impulses, we can combine the
preceding equations with the friction equations, to end up with
g max =
g normal μ
where g normal is the impulse in the direction of the contact normal (i.e., the im-
pulse we are currently calculating in our velocity resolution algorithm). Notice that
these impulse values are scalar. This tells us the total impulse we can apply with static
friction. In code this looks like
// ... Find the impulse required to remove all three components of
// velocity (we'll return to this algorithm later) ...
real planarImpulse = real_sqrt(impulseContact.y*impulseContact.y +
// Check whether we're within the limit of static friction.
if (planarImpulse > impulseContact.x * friction)
// Handle as dynamic friction.
Dynamic friction can be handled by scaling the y and z components of the im-
pulse so that their combined size is exactly μ times the size of the x impulse: