Game Development Reference
In-Depth Information
The Connected Body is the same as with a Fixed Joint. The None default connects it to the world,
or you can select a specific game object to which to connect the joint.
The Anchor is the position of the hinge axis in local space. For the Link01 game object, set the
Anchor position to (-0.5, 0.5, 0). In the Scene view, you will see a small orange arrow representing
the hinge joint (Figure 7-6 ).
Figure 7-6. Orange arrow representing the Hinge Joint location and axis
The connected game object swings around the Axis of the hinge joint. Set the axis of the Link01
Hinge Joint to (0, 0, 1).
The Hinge Joint can behave as if it is spring-loaded with Use Spring . The game object will swing
around the joint automatically as if motor-powered with Use Motor . Limits allows you to constrain
how far the object can rotate around the hinge joint and whether it bounces when it reaches the limit.
The pendulum links won't require any of these properties, but you can select the blue book icon to
read more about them and their respective settings.
Finally, the Hinge Joint also has Break Force and Break Torque properties that determine the force
at which the joint action is overcome and the game objects simply break apart from each other.
Build the Pendulum Chain
Link01 is the first of seven making up the “chain” that swings the Pendulum Sphere. Now that it
has a Rigidbody component and Hinge Joint, you can use it to create a Prefab. In the Project panel,
open the Assets ➤ Prefabs folder. Drag the Link01 game object from the Hierarchy to the Prefabs
folder and name the new prefab Link. When you rename the prefab, the original Link01 game object
also changes to Link. Select it in the Hierarchy and rename it Link01. Now drag the Link prefab to
the Scene view, name it Link02, and assign a Transform position of (5.5, 25, 60). Select Link01,
then in the Inspector select Link02 for the Connected Body property of the Hinge Joint component.
Continue to add links in this fashion until you have seven of them as seen in Figure 7-7 . Note that for
each new Link the x value of the Transform should decrement by 1, the y value should increase by 1,
and the z value should remain at 60. Link07 should have None for the Connected Body property.
 
Search WWH ::




Custom Search