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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset