O'Reilly logo

Unity Android Game Development by Example Beginner's Guide by Thomas Finnegan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required