Book Image

Building Levels in Unity

By : Volodymyr Gerasimov
Book Image

Building Levels in Unity

By: Volodymyr Gerasimov

Overview of this book

Table of Contents (17 chapters)
Building Levels in Unity
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
4
Dealing with Basic Animations
Index

Rigidbodies


It is about time we finalize our character and make him move around, taking landscape into consideration. For that, we need to rely on physics and, more specifically, a component that will enable our GameObject to follow physical laws—rigidbody.

Right now, the character that we've imported and set up animations for in Chapter 5, Invite Your Characters to Unity and Chapter 6, Using Mecanim for Advanced Animations is completely ignoring the environmental obstacles around itself and walks through walls like a ghost. To demonstrate how rigidbodies work, we will eliminate this issue by allowing our character to behave naturally and react to the environment properly. We will do this in four steps, and I would strongly recommend you to test the character in Play mode after each step to see the difference for yourself:

  1. Attach the Rigidbody component to the Robot GameObject in the Scene window (Add Component | Physics | Rigidbody). This will allow gravity to influence our character model...