

Remember, a transform is simply XYZ coordinates in our 3D space. To create this, go to Game Object on the menu bar and choose “Create Empty”. Our spawnpoint is going to be an empty transform whose location will be used in our script to determine where our projectile spawns at. Now that we have our character controller, we need to create a spawnpoint. If you have a Main Camera in your hierarchy, go ahead and delete it since the FPS Controller has a camera attached to it already. Now, when you play your game, you should be able to move using WASD. Once the cube is in your scene, scale the X and Z axis out so that the cub resembles a plane that you can walk on. Go up to “Game Object” on the menu bar and choose “3D Object” → Choose Cube. You will also want to create an object that you can stand on. Once your project is created, go to your asset browser and open up Standard Assets → Characters → First Person Character → Prefabs → Drag and Drop an FPS controller into your scene. When you create your Unity project, be sure to import the Standard Assets Character package into your project, as seen in this screenshot. For this example, we will use an FPS Character. The first thing you need to have is a character. That’s the basic overview of what all we will need to make this mechanic work. Lastly, we need a script that dictates what our projectile is, and how we instantiate it and move it within our scene. Making the spawnpoint a child of the main character ensures that the spawnpoint moves position according to the movements of the parent character. This character needs to have a spawnpoint attached to it as a child. We have to have a character that our player controls. You should know what transforms and rigidbodies are at the very least.įirst of all, we need to think about the logic of shooting a projectile in 3D space.

Also, these instructions assume that you have an entry level understanding of the Unity game engine.

If I fail to cover something in this post that you are curious about, then check out that video. In this post, I am going to outline how you create a projectile and shoot that projectile outwards from a character using the Unity Game Engine.īefore I jump into it, I want to post a link to my tutorial video that covers this topic in detail. Of course, implementing a shooting mechanism is not quite as simple as running a function called ShootBullets(). As a game designer, you can have your character shoot whatever your heart desires. One of the most common mechanics that you’ll find in almost any video game is the ability to shoot something.
