Book Image

Building an FPS Game with Unity

5 (1)
Book Image

Building an FPS Game with Unity

5 (1)

Overview of this book

Table of Contents (18 chapters)
Building an FPS Game with Unity
Credits
Foreword
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
Index

Creating the weapon


Next, let's add the weapon by performing the following steps so that our player can use it:

  1. From the Hierarchy tab, go to the AdvancedPlayer object and expand it. Expand the FPSCamera object to show all of the weapons that the player can use. From there, click on the 1Pistol object and press Ctrl + D to duplicate the object (alternatively, use Edit | Duplicate).

  2. Move the newly created object below the 4Mace object and rename it to 5CQ Assault Rifle.

    If we were to play the game right now, we could press 5 and a second pistol would be displayed. Let's make it so that it will display our new weapon by replacing the weapon that is being rendered in the Vp_FP Weapon (Script) component. The Vp_FP Weapon (Script) component is used to animate a weapon using its procedural motion properties. This means that the component will manipulate the weapon transform's position and rotation using springs, bob, and perlin noise.

  3. With the 5CQ Assault Rifle object selected in Hierarchy, go to...