Game Development Reference
In-Depth Information
As you can see, depending on your own game environment, gravity can
be set in any direction, including upward and sideways.
Unity Hands On
Applying Gravity
Step 1. Start Unity and create a new project. Orient the Scene such
that the y axis is pointing upward. Position the camera so that it has
the same view as shown in the Scene. To do this, select the camera
from the Hierarchy and then from the main menu GameObject >
Align with View.
Step 2. Add a sphere to the Scene and position it at the top of the
camera view. With the sphere selected in the Hierarchy, select from the
main menu Component > Physics > Rigidbody. The result of this will
be a new component added to the sphere in the Inspector, as shown
in Figure 2.28 . The Rigidbody component makes the sphere part of
Unity's physics processing and as such gravity will be applied to it.
Fig 2.28 A Scene with a Sphere that
has a Rigidbody attached.
Search Nedrilad ::




Custom Search