A Little Physics in Unity- Game Dev Series 08

S.J. Jason Liu
2 min readMay 3, 2021

--

Physics is what makes a game more realistic and more fun.

Previous: A Cooldown System

So far we have made some movement and shooting action. The next part would be create an enemy. Before we create an enemy, we should know the basic physics in Unity- Rigidbody.
Rigidbody can make our game object to interact with real world physic, such as gravity.

We can create a rigidbody simply by add a component insides Inspector window.

A rigidbody component for a 3d object

The first thing you would notice the different is gravity. When you play with a game object that contains a rigidbody with gravity checked, it would falls straight down as gravity is dragging it.

You can see the difference by check the gravity

With rigidbody, you could even create a lot of ways to play with gravity.

A rigidbody is usually used with collider. As the name, a collider is used for process the collide between game objects. Without the collider, the game objects would go through each other. In our game, a collide would happen between the laser and the enemy, or the enemy and the player.
We will talk about collider later, let’s create an enemy now.

Create a cube and change the name to Enemy. Then add a rigidbody component to it.
You can hit Play and see what would happen,

Don’t forget to give your enemy a material

The enemy was falling straight by gravity and stopped above the Player because the collider. When we create a new game object, there is always a collider attached to it.

That’s the first step to play with rigidbody. Next, we will make the collide more reasonable.

--

--

S.J. Jason Liu
S.J. Jason Liu

Written by S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

No responses yet