Game Development Reference

In-Depth Information

So, if our goal is to calculate the impulse at the collision, we need to understand

what effect an impulse will have on each object. We want to end up with a mathemat-

ical structure that tells us what the change in velocity of each object will be for any

given impulse.

For the frictionless contacts we're considering in this chapter, the only impulses

generated at the contact are applied along the contact normal. We'd like to end up

with a simple number, then, that tells us the change in velocity at the contact, in

the direction of the contact normal, for each unit of impulse applied in the same

direction.

As we have seen, the velocity change per unit impulse has two components: a lin-

ear component and an angular component. We can deal with these separately and

combine them at the end.

It is also worth noting that the value depends on both bodies. We'll need to find

the linear and angular velocity change for each object involved in the collision.

The Linear Component

The linear component is very simple. The linear change in velocity for a unit impulse

will be in the direction of the impulse, with a magnitude given by the inverse mass:

m
−
1

˙

p
d
=

For collisions involving two objects, the linear component is simply the sum of

the two inverse masses:

m
−
1

b

Remember that this equation holds only for the linear component of velocity—they

are not the complete picture yet!

m
−
1

a

˙

p
d
=

+

The Angular Component

The angular component is more complex. We'll need to bring together three equa-

tionswehavemetatvariouspointsinthebook.Forconveniencewe'lluse
q
rel

for the

position of the contact relative to the origin of an object:

q
rel
=

q

−

p

First, equation 14.2 tells us the amount of impulsive torque generated from a unit

of impulse:

q
rel
×
d

where
d
is the direction of the impulse (in our case the contact normal).

Second, equation 14.1 tells us the change in angular velocity for a unit of impul-

sive torque:

u

=

θ

I
−
1
u

=