Game Development Reference
In-Depth Information
e = −(| v 1+ | − | v 2+ |)/(| v 1− | − | v 2− |)
In these equations the velocities are those along the line of action of the impact, which
in this case is a line connecting the centers of mass of the two objects. Since the same
impulse applies to each object (just in opposite directions), you actually have three
equations to deal with:
| J | = m 1 (| v 1+ | − | v 1− |)
| −J | = m 2 (| v 2+ | − | v 2− |)
e = −(| v 1+ |− | v 2+ |)/(| v 1− | − | v 2- |)
Notice we've assumed that J acts positively on body 1 and its negation, -J , acts on body
2. Also notice that there are three unknowns in these equations: the impulse and the
velocities of both bodies after the impact. Since there are three equations and three
unknowns, you can solve for each unknown by rearranging the two impulse equations
and substituting them into the equation for e . After some algebra, you'll end up with a
formula for J that you can then use to determine the velocities of each body just after
impact. Here's how that's done:
For body 1: | v 1+ | = |J|/m 1 + | v 1- |
For body 2: | v 2+ | = -|J|/m 2 + | v 2- |
Substituting | v 1+ | and | v 2+ | into the equation for e yields:
e (| v 1- | - | v 2- |) = -[( | J |/m 1 + |v 1- |) - (-| J |/m 2 + |v 2- |)]
e (| v 1- | - | v 2- |) + | v 1- | - | v 2- | = -J (1/m 1 + 1/m 2 )
Let | v r | = (| v 1- | - | v 2- |); then:
e | v r | + | v r | = -| J | (1/m 1 + 1/m 2 )
| J | = -| v r |(e + 1)/(1/m 1 + 1/m 2 )
Since the line of action is normal to the colliding surfaces, v r is the relative velocity along
the line of action of impact, and J acts along the line of action of impact, which in this
case is normal to the surfaces, as we've already stated.
Now that you have a formula for the impulse, you can use the definition of impulse
along with this formula to calculate the change in linear velocity of the objects involved
in the impact. Here's how that's done in the case of two objects colliding:
v 1+ = v 1- + (| J | n )/m 1
v 2+ = v 2- + (-| J | n )/m 2
Search Nedrilad ::




Custom Search