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 – simple shooting

With the addition of one more object and a single script, we can start shooting at our targets.

  1. First, we need to add an empty GameObject to our tank. Rename it to MuzzlePoint and make it a child of the cannon's pivot point object. Once done, position it at the end of the cannon so the blue arrow points away from the tank, along the same direction as the cannon. This will be the point where our bullets will come from.
  2. We also need something to indicate where we are shooting. The explosions are covered in future chapters, so choose Sphere from the Create Other menu and rename it TargetPoint.
  3. Set the sphere's scale to 0.2 for each axis and give it a red material. This way it can be more easily seen, without being completely ...

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