Building an explosive barrel

One of the first things we are going to look at is the common FPS staple: explosive barrels. These will allow the player to get a "leg up" on their enemies by causing explosions when damaged enough. They're also fairly simple to create.

  1. To start off, let's open up the level we created in the Chapter 5, Building Encounters (Chapter 5_5_ HealthPacksPickups.unity in the example files you can get from the Packt Publishing website).
    Building an explosive barrel

    Let's get the implementation of the functionality to work correctly, then we can make it look nice.

  2. Create an object to represent our barrel. To do this, go to GameObject | 3D Object | Cylinder

Get Building an FPS Game with Unity 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.