Book Image

Learning Unity iOS Game Development

Book Image

Learning Unity iOS Game Development

Overview of this book

Table of Contents (14 chapters)
Learning Unity iOS Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
6
Main Menu, iAds, Leaderboards, Store Purchases, and Achievements
Index

Adding Rigidbody 2D


The Rigidbody 2D component is a component that simulates the basic physics for the GameObject it is attached to. In our case, it will simulate the gravity for our character, allowing it to appear as if it is running into other GameObjects, jumping and falling.

With the Character GameObject selected, click on Add Component in the Inspector tab.

Search for Rigidbody 2D and click on Rigidbody 2D from the list to add it.

In the Inspector tab, with the Character GameObject selected, click on the Fixed Angle checkbox inside Rigidbody 2D. This will force the rigid body component to stay fixed to an angle and avoid spinning, resulting in the character doing flips.

This is it for Rigidbody 2D. It is a cool component that does a huge amount of work for us with little effort.