Weapons
What goes pew-pew-pew!
Weapons are scriptable objects that allow to configure how a weapon looks like, how to hold it, as well as link it to a particular Ammo object.

A Weapon has some required fields that must be filled. If these are not correctly set up, an error message will be prompted.
Fields Overview
We'll overview each of the fields from top to bottom. Both the Name and the Description are quite self explanatory and are primary used when displaying the name of the currently active weapon on a UI canvas.
General
This section allows to configure some general settings, such as the sound effects played when drawing and holstering the weapon.

The Default Ammo field is a required one that is used when a Weapon is equipped but no ammunition is specified.
State Ease & State Aiming
When a Character pulls a weapon, it automatically enters a At Ease state, in which the Character can freely move with the weapon at hand.

The State Aiming section allows to configure how the Character will behave when, with a weapon at hand, it aims at a target.

We'll cover these two sections as one, since most of the fields are shared.
Pitch Offset
This property is exclusive of the State Aiming and allows to modify pitch (up and down) angle in which a weapon is aiming.
This should always be 0, but it's there in case your animation has a slight precision error. For example, if your weapon points forward but the character looks like it's aiming down, you can increase the value and the character will aim higher.
State and State Mask
These are one of the most complex properties to set. The Shooter module is heavily animation driven and relies a lot on the Game Creator's custom animation system.
Let's explain these concepts using the Revolver example. When the Character draws a gun, it plays an animation where its right arm reaches to its back and picks a revolver. After that, the character changes (or not) its stance.

This is done using a Locomotion State, which allows to have an animation clip played when entering the State (drawing the gun) as well as another one when leaving it (holstering the weapon).

Stabilize Body
This option is a bit of a blackbox that magically makes your character's upper body stand straight, despite of the animation.
This is done using a custom algorithm that reads information about the character's hip and spine rotations and compensates their movement in order to keep the whole upper body steadier.
This option is particularly useful on the Aiming State. It allows to rotate the hips and spine in order to compensate the noise produced by any lower body movement. This will allow to automagically have a much steadier weapon holding hand.

Notice how on the right side of the previous GIF, all bones from the shoulder to the hand stand very steady, whereas on the left side, all bones inherit the movement from previous bones, resulting in a lot of added noise at the tip of the gun.
Upper Body Rotation
This property allows to rotate the low spine bones of the Character in order to more accurately represent how the weight of the weapon affects the balance of the Character.
Lower Body Rotation
This property is very useful for quickly creating different stance poses from a single State, without having to create an entire Locomotion State.
Not all weapons are held the same way; most of them modify where the feet point at in relation to the forward direction of the gun. For example, when aiming with a gun, the character will usually have their feet pointing at around 20 to 30 degrees from the character's eye direction. Other weapons, like the bow, tend to rotate the lower body up to 90 degrees, making the head look through the shoulder.
3D Model
This section allows you to define what the visual representation of the weapon will look like. However, the weapon serves also another important purpose, which is telling the direction of this one as well as where the Muzzle is.

You can define what prefab object will be used as a weapon as well as which bone is it going to be attached to.
The Muzzle
As mentioned before, the 3D Model prefab used as a weapon serves two purposes: visually represent the weapon and tell Game Creator where the muzzle is and what direction is forward.
For this, there's a special component that is required for all prefab models called Weapon Muzzle. See the following screenshot as an example of the Revolver's Muzzle Component.

The Muzzle Component can be added anywhere in the 3D Model prefab object, as its value is searched and cached the first time weapon is equipped. It is important to place it at the tip of where the muzzle flash is going to appear.
Last updated
Was this helpful?