Asteroids – Rigidbodies

We have now set up 3 asteroids in our scene which appear at the start of the game. We need to add a Rigidbody to them so we can start moving them around and have them collide with things.

But what exactly is a Rigidbody? A Rigidbody is a component added to an object which allows Unity to control its motion with physics. In other words Unity will apply forces to the object to move it. For example gravity or the forces from a collision with another object. This is exactly what we want with our asteroids (and eventually our ship).

In the assets folder locate the asteroid prefab. Click the add component button in the inspector and add a Rigidbody. 

Asteroid Prefab in Assets
Adding a Rigidbody 

Make sure gravity is turned off because otherwise when the object is instantiated it will keep falling away from the camera forever. 

Turn Gravity off

We will leave all the other settings as they are for now, but we may revisit them when we start to add motion to the asteroids.

This is a very short tutorial but I hope you now understand what a Rigidbody is. For more reading on them you can find the unity documentation here. In the next part we will look at for loops and how we can use them to change how many asteroids are in the scene.


Leave a Reply