Game Development Reference
In-Depth Information
F IGURE 14.4
Linear projection causes realism problems.
Linear Projection
We could use the same algorithm as before: changing the position of each object so
that it is moved apart in the direction of the contact normal. The amount of move-
ment should be the smallest possible such that the objects no longer touch.
For collisions involving two objects the amount each one moves is proportional
to its inverse mass. Therefore a light object has to take on more of the movement than
This approach works and is very simple to implement (in fact it uses the same
code as for the mass-aggregate engine). Unfortunately it isn't very realistic. Figure 14.4
shows a block that has been knocked into the ground by another collision. If we use
the linear projection interpenetration resolution method, the situation after the colli-
sion is resolved will be as shown. This is in contrast to the third part of the figure that
shows how a real box would behave.
Using linear projection makes objects appear to twitch strangely. If you only have
to deal with spherical objects, it is useful and very fast. For any other object we need
something more sophisticated.
Velocity-Based Resolution
Another strategy used in some physics engines is to take into account the linear and
angular velocities of the objects in the collision.
At some point in their motion the two objects will have just touched. After that
time they will continue interpenetrating to the end of the time step. To resolve the
interpenetration we could move them back to the point of first collision.
In practice, calculating this point of first collision is difficult and not worth wor-
rying about. We can approximate it by considering only the contact point on each ob-
ject as generated by the collision detector. We can move these two points back along
the paths they followed until they no longer overlap in the direction of the contact
normal. 4
4. This isn't the same as finding the first collision point, because it is often not the contact points generated
by the collision detector that are the first to touch: in fact it can be completely different parts of the objects
that touch first.
Search Nedrilad ::

Custom Search