Game Development Reference
In-Depth Information
Spring Enabled allows the connected bodies to separate and bounce back rather than be-
ing rigidly confined to the pivot joint's anchor. It is like combining a pivot joint with a
spring joint. The Reference angle determines the natural direction of the spring, but it does
not rigidly constrain the movement of the bodies along this very angle. The Rest Angle
setting allows you to further offset the spring angle in case you need to enable both Spring
and Limit , but the spring needs to point in a different direction than the Reference angle.
Note that negative angle values are perfectly okay.
The Spring Damping and Stiffness values are the same as for the spring joint. Damping
comes into effect when the two bodies are either moving toward or away from each other.
The default damping of 1 does not change the bodies' velocities at all. But a value of 0.9
would reduce the two bodies' velocity pointing away from or toward each other by 10%
every second. A damping value of 0 would allow the two bodies to move away or toward
each other only at very low speed. If you want a spring that deserves its name, you'll want
to use a damping value somewhere between 0.5 and 1.
A spring's stiffness essentially determines how strong the spring is. A high stiffness value
will have the two bodies apply a lot of force to quickly take their intended positions, while
a low stiffness value would only gradually pull the two bodies together or away from each
other.
The Limit Enabled setting allows you to determine the Min and Max angles the two bodies
are allowed to rotate around each other. To be precise, it determines the angle limits relat-
ive to Body A . Since the pivot joints for the chain should have an angle limit, select the
Limit Enabled check box and enter a range from -135 to 135 in the Min and Max fields, as
shown in Figure 9-7 . This prevents the chain elements from overlapping each other too
much and specifically prevents them from making a complete revolution, an impossible
behavior for a real-world chain.
Figure 9-7 . Pivot joint with angle limits enabled
Notice how, with the Reference angle setting being 0, there is an upward-facing arrow on
the joint on the stage, as well as a shorter and a longer selection handle. You can drag
these handles to change the Min / Max values. If you look at this limit from the perspective
Search WWH ::




Custom Search