Game Development Reference
In-Depth Information
Figure 7-7. The Pendulum Sphere and “chain”
Save the scene and try it out. Notice how Link07, with a Hinge Joint Connected Body property of
None, is automatically suspended from a fixed point in the world. Exit Play mode.
In the Scene view, with the left mouse button pressed, drag the cursor across all of the cube chain
links and the Pendulum Sphere game object to select them. Press +D to duplicate the entire
pendulum structure, then drag the duplicate pendulum to a Transform Position z coordinate of 72.
Repeat these steps to place a third pendulum at a Transform Position z coordinate of 84.
Take a look at the Hierarchy. Now you have three each of the numbered link game objects from 1
to 7, and three Pendulum Spheres—what a mess. This is a great example of the need to maintain
organization as you develop your game. In the editor top menu, select Game Object ➤ Create Empty
and name it Pendulum_01. In the Hierarchy, find each of the links to the first pendulum along with
the sphere and drag and drop them into the Pendulum_01 game object. In the same fashion create
Pendulum_02 and Pendulum_03 empty game objects to hold the game objects that comprise the
second and third pendulum obstacles. Much better—now your Hierarchy has easily identifiable,
numbered, pendulum parent game objects that can be expanded as needed for further adjustment
of the pendulum child game object building blocks.
To vary the obstacles, move the second pendulum to begin its swing from the left side of the
obstacle course. Change the sign of the Transform Position x coordinates of all of the link and
Pendulum Sphere game objects to negative (Figure 7-8 ).
 
Search WWH ::




Custom Search