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.
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.
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.
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.
This property is exclusive of the State Aiming and allows to modify pitch (up and down) angle in which a weapon is aiming.
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).
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.
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.
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.
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.
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.
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.
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.