My 120-day journey to being a better Unity Developer — Day 10

Introduction to Physics in Unity

Jean-Noel Seneque
3 min readMay 6, 2021
Experimenting with Ragdoll Physics

In a previous article Simple player movement in Unity, we controlled a game object by telling it (via script) where to go using the Transform.Translate.

Simple Player Movement example

Unity has another way of moving game objects around in a realistic way by (an approximation) using forces that exist in the real world, such as velocity, acceleration, and gravity. Let’s understand some key concepts.

Collider — is a component that is added to a game object that registers when a game object touches or interacts with one another. Unity has several colliders:

Searching for colliders

Rigidbody — is a component that allows a game object to be affected by Physics, such as gravity. It contains the physics properties of Mass, Velocity, and Drag. In this example, the platform is suspended in the air, and look what happens when we add a Rigidbody to it while in Play mode, gravity force takes effect straight away.

Add the Rigidbody component
The Rigidbody component’s Physics properties

If I was to turn off the collider on the platform for a moment, you will notice the ragdoll, who has a rigidbody (gravity force acting on it), moves through the platform since it no longer has a collider.

Turn off collider

In the final example below we have the male model with a rigidbody component that simulates falling using the gravity force and a collider so it interacts with the platform and ground as they touch each other.

That pretty much covers the key concepts. In the next article, we will explore two events related to physics, OnCollisionEnter and OnTriggerEnter.

If you enjoyed reading this article give me a Clap, also if you want to see more like this, “Follow” me, so you may be notified of future releases. You may also send me a message if you need any further help.

--

--

Jean-Noel Seneque

A Data & Analytics Consultant who is expanding into developing experiences in XR, Enterprise and Gaming space using Unity www.jeannoelseneque.com