Unity Physics 101

Ryan Sweigart
2 min readApr 3, 2021

--

Without applying physics to a game object, it won’t really interact with the game world. We can still move it around, and even allow the player to move it around, but the game might get stale quickly if the player is just a ghost floating through the world. Here we the ubiquitous Ethan in such a state, suspended in space.

“I’m just hanging around, bro.”

Now let’s give Ethan a component called a Rigidbody.

“You said you’d never let me down, broseph!”

Whoa! Ethan falls right through the floor! Why? It turns-out our floor also needs a Rigidbody.

“Are you serious right now, broski?”

Wait, what? The floor fell too! Oh, wait, that’s because a Rigidbody has gravity enabled by default. Let’s uncheck the “Use Gravity” box on the floor’s Rigidbody. This seems like the right fix, but Ethan will go back to falling through the floor again. We need to add something to Ethan and the floor that will let them interact with each other. That something is called a collider. Let’s see what happens when collider components are added to Ethan and the floor:

“Going down, brotien!”

Looks like the floor can’t handle Ethan’s weight! There’s a setting on the Rigidbody’s component called “Is Kinematic” that is disabled by default.

“Kinematics is a subfield of physics, developed in classical mechanics, that describes the motion of points, bodies (objects), and systems of bodies (groups of objects) without considering the forces that cause them to move.” — Wikipedia

Enabling “Is Kinematic” causes the floor to ignore Ethan’s weight. We’ve finally accomplished our goal! Ethan thanks you!

“Good ‘ol terra firma! Thanks, brosicle!”

--

--

Ryan Sweigart
Ryan Sweigart

Written by Ryan Sweigart

An independent Unity Developer.

No responses yet