Game Development Reference
In-Depth Information
The remaining cube happily ramps up and then spins merrily around on its own.
9.
Stop Play mode.
Joints
As mentioned earlier, Unity has a several Joints to allow you to combine physics objects
(gameObjects with Rigidbody components). You will be doing a few tests with the Hinge Joint, the
most familiar of the joint types.
1.
Select the active cube, and focus the viewport to it.
2.
Set its Y Torque to 30 .
3.
Create a new Cube, and name it Lid .
4.
Scale its X to 0.01, and move the Lid to the side of the Cube.
5.
From the Component menu, Physics, select Hinge Joint (Figure 3-23 ).
Figure 3-23. The Hinge Joint component
When the Hinge Joint is added to an object that does not already have one, a Rigidbody component
will be added automatically.
As a default, the Hinge Joint's axis of rotation is set to X. You can see the small axis at the top of
the Lid, pointing across (or away from, depending on the side you chose) the top face of the cube
(Figure 3-24 ).
 
Search WWH ::




Custom Search