Game Development Reference
In-Depth Information
Figure 9-14 . The effect of a complex physics object “exploding.” Physics debug drawing highlights the large
distances between the chain and rope segments
Figure 9-14 shows what can happen momentarily to the distorted chain and ball when
they're placed so that they overlap each other. The _drawPhysicsShapes custom
property on GameScene.ccb was enabled to highlight the physics objects and joints. This
effect is typically referred to as an “exploding” physics object.
Minimizing the Risk of Physics Bodies “Exploding”
The number one cause you always have to watch out for but can never prevent entirely
occurs when two complex physics bodies somehow get stuck inside each other. Both ob-
jects' constraints will frantically try to resolve their constraints, adding forces to the other
body, which in turn fights back through its own constraints.
This can happen so quickly that the effect seems like everything is okay one moment and
the objects are completely whacked, if not gone altogether, a moment later.
The effect isn't always this extreme, but it can be. Editing each joint's Max force setting
will help reduce the probability of the complete and utter destruction of complex interact-
ing physics objects. With a maximum force applied to all constraints, chains and ropes
could still get stuck within each other, wiggling and fighting each other, but their joint
connections will largely remain intact.
Of course, you should certainly avoid placing chains and ropes so that they start out over-
lapping in the first place.
Search WWH ::




Custom Search