Game Development Reference
In-Depth Information
Figure 6-7. Target Practice in the Game view
Physic Materials
You can further refine the collision behavior of your game objects in collisions by using Physic
Materials. Physic Materials are assets that define the bounciness and surface friction properties.
Two objects sliding against each other lose energy through friction, and a bouncing object also loses
energy when it strikes another surface with each bounce.
This scene is a way to test physic materials. First, you are going to test pushing a cube on a flat
surface. Create a new scene and name it PhysicMaterialsTest, and as always, add a directional light.
Select the Main Camera and change its Transform position to (0, 1, -7). Create a plane, then create
a Cube game object with a Transform position of (0, 0.5, 0). Add a Rigidbody component to the
Cube with Add Component ➤ Physics ➤ Rigidbody in the Inspector or Component ➤ Physics ➤
Rigidbody from the top menu.
In the Project panel, first select Assets, then Create ➤ Folder and name the folder Physic Materials.
With the Physic Materials folder selected, now choose Create ➤ Physic Material. You may have to
scroll down a bit to find it. Name the new physic material Icy (Figure 6-8 ).
Figure 6-8. Physic Material asset in the Inspector
 
Search WWH ::




Custom Search