Tutorial: Basic Shooting - Setup

In this short tutorial we will look at the simplest ways to make an object shoot. This is a very basic shooting mechanic but can be used in various ways, such as a basic character or vehicle weapon. There are many ways to expand beyond this action as it can be dynamically controlled via a host of lua commands and Event functions (a Lua function called by the Damage action) there are even a few visual modules that also react to this action, but for this tutorial we will keep it simple.

1) Open a Template Scene

You have a choice here, either open the basic Character scene you made in the Basic Character Tutorial and move to LINK: Shoot or, continue with this first step…
Ah you have chosen the continue with this first step option. Your character receives 150XP for your bravery!

a) Open a new scene from the Start Screen as we need some undulated ground to see the shooting effect as our basic shoot will be a line of sight with no elevation.

b) From the main tool bar click on the “House icon” to open the page.

c) Select and double-click LMB on the template: “02 Template Uneven_Ground B”


2) Add a Test Object

We are going to add a cube to our new scene from the Game Objects panel. Once selected, the Game Object’s paint mode is activated and a representation of the selected object will show in the scene.
Now when you click in the scene, the Game Objects paint mode will place a copy of this object for you.

To open the Game Objects panel, click on the “Red Gamepad Icon”. This button is a toggle on/off type, clicking whilst the Game Objects panel is currently open will close the panel.

a) From the Game Objects panel locate the “CubeSmall” object in the Topic: Shapes > Category: Geometry folder.

b) Click somewhere on the ground to place a new cube please see the following image:




3) Entity Properties

To find the entity properties panel. Look for the name Properties in the row of tabs under the right hand side panel (default Layout).

These tabs contain most of the common options for use when developing a scene.

If you cannot see the name there you may need to scroll along the tabs with either the middle mouse wheel or the arrows to the right.

We are going to make a change of the cubes base properties. The reason for this is that all static Game Objects by default have their “Update Mode” set to “Static”.
For performance reasons an object that will never move in the game, should be set to static. This object will also be taken into account when using any AI Navigation.

4) Base Properties – Update Mode

In our tutorial we are going to be moving the cube around, it is therefore classed as “Dynamic” and should have its“Update Mode” set as such.

a) Select the cube and locate its base property. Click on the left hand arrow or Double LMB anywhere on the option bar to expand this option to see all the properties.

b) Find the “Update Mode” property and from the drop down select “Dynamic”




5) Action Editor

An “Action” brings our entity to life. An entity can have many “Actions”. Actions provide various functionality such as, script, game mechanics, and controllers. When these are combined with an entity, your game world can come alive!
When attached “Actions” have their own special properties which get prepended to the entity’s property panel.
We are going to move our cube, and make it shoot, by using an action.

First select the cube and open the ”Action editor”. RMB to open the context menu and then click on “Action – Editor”.

Or you can click the Action Editor Icon at the top of the property panel in its tool bar.

6) Remove an Action

From the open ”Action editor” select the “PhysX RigidBody” action from the right hand side listand then click the lower left arrow to remove the action from the entity.

a) Select the cube and locate its base property. Click on the left hand arrow or Double LMB anywhere on the option bar to expand this option to see all the properties.

b) Find the “Update Mode” property and from the drop down select “Dynamic”




7) Add a Simple Player Controller

To make the cube move and rotate we need to add a ”Simple Player Controller” action. This controller works straight out of the box. Although not feature packed, this controller requires zero scripting!
A more powerful character controller would need the use of scripts or visual modules but this is outside the scope of this tutorial.

a) From the action editor select the ”PHYSICS”category, choose the action named ” “PhysX Player Controller”.

b) Then click on the lower ”right facing arrow” to attach this action to our entity.

8) So far so Good

That's the end of the first section. Here we have located the property panels, opened the action editor and removed and added an action. These are processes that will become second nature over time.

If you want to press play, go for it! Just move your camera back by spinning the “mouse wheel” to add a little distance between you and the object.
The ”Play” button is located at the right hand side of the main tool bar.
Keys WASD will move and strafe. Use the Mouse to turn the cube.
Key W will move the object forwards in the direction it is facing, this direction is controlled with the mouse.

In the next section we will add the “Shooting Action” and see how to make the simple shooting mechanic. Then go have a well earned coffee … (substitute your favorite beverage)