Time for action – adding collisions

We need to add some collision capabilities to our space objects, so that they can crash into each other and be shot at properly:

  1. Let's start by giving collision to the asteroid. Do this by first selecting the mesh for the asteroid and adding a MeshCollider component. This will later let us shoot at the asteroid.
  2. Next, select the same object that holds our Asteroid script component. Add a SphereCollider component to the object and adjust the Radius to be a little larger than the asteroid. This collider will detect when the asteroid has collided with the player.
    Time for action – adding collisions
  3. The SphereCollider needs to have the Is Trigger checkbox ...

Get Unity Android Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.