Shooter module overview popularité : 69
Weapons popularité : 88
Ammunition popularité : 91
Advanced API popularité : 92
Slide 1
Slide 2
Slide 3
Slide 4
Slide 5
Slide 6
Slide 7
Slide 8
Slide 9
Slide 10
IMAGE OR CARROUSEL for section header You successfully read this important alert message.

TEXTE AVANT FILTRAGEAmmunition (from now on Ammo) are the other objects used by the Shooter module that allow you to create any kind of weapon. Weapon objects allow you to define how the Character behaves using a certain gun, but Ammo allows to define what happens when shooting it, charging shots, how the aiming is done, etc...

assets%2F-LAqwYovmUPn5V6CMeID%2F-Lq78TL05AQvAkeUrEHt%2F-Lq7AVQWVKs3ire_sfDU% (...)

(Ammo Inspector overview)

The Ammo object is split in 3 big blocks: naming, a few expandable sections and the three Action lists at the end.

Naming

This block is very similar to the Weapon object. Allows you to give the ammunition a name and a description. These values can be localized.

It is important to notice there’s another field called Ammo ID. This field allows to identify the ammunition among the rest. It is important to use a unique value. By default we provide a very long text composed of lower, upper and numeric characters. However, you’re feel free to change this for a more meaningful name.

Sections

The Ammo object is organized in 7 different expandable sections. Each one deals with a particular feature, such as playing an animation when the weapon is shot, how the weapon travels to its destination, etc...

General

The General section manages common settings related to how the weapon behaves.

assets%2F-LAqwYovmUPn5V6CMeID%2F-Lq78TL05AQvAkeUrEHt%2F-Lq7CP-hrwR_GrhvKsc9% (...)

(Ammo General section)

The Fire Rate property tells the maximum amount of bullets that the weapon can fire per second. It is important to note that successive bullets fired out of the rate period will be ignored.

Infinite Ammo checkbox tells the Shooter system to skip checking and subtracting bullets from the magazine. However, notice that, because bullets won’t decrease, your clip size will never be reduced and the shooter won’t ever need to reload.

Clip Size is the amount of bullets that are available to be shot before reloading the gun.

Auto Reload allows to immediately reload the weapon when trying to shoot and there are no bullets left in the clip. This is the default behavior in most games.

Reload Duration defines how long will it take for a weapon to be reloaded. It is important to mention that this time is also used to stretch or shrink the animation played while reloading.

Aiming

The Aiming section deals with how the Weapon with this particular Ammo aims at its target.

The aiming section has an aiming mode dropdown with three options: None, Crosshair and Trajectory. Let’s break them down.

None
There’s no visual indication to how the bullets will be fired. Not commonly used, but if your weapon has a crosshair integrated in your 3D model, it could be useful.

Crosshair
Crosshairs are the little cross that appear at the center of most first person shooter games. It gives information about where the bullets will impact as well as the current accuracy.

assets%2F-LAqwYovmUPn5V6CMeID%2F-LqAYGVO7tW7nAGOqK6p%2F-LqAciv2hkfg8A8dQVJ5% (...)

(Crosshair-High-TechA)

The Crosshair Mode displays a couple of properties. Crosshair property allows to define the prefab object that will be used when aiming.

assets%2F-LAqwYovmUPn5V6CMeID%2F-LqAYGVO7tW7nAGOqK6p%2F-LqAbggZ9zIu1nBYBLZs% (...)

(Aiming mode: Crosshair)

Focus Time defines how long will it take for the weapon to go from least accurate to maximum accurate. For example, a value of 0.25 means it will take 0.25 seconds to steady the hand. We’ll talk more in depth about accuracy at the Shooting section.

Trajectory
The Trajectory aiming mode is the most complex one. It allows to visually display a diegetic line or a gravity-affected trajectory gizmo.

assets%2F-LAqwYovmUPn5V6CMeID%2F-LqAfnxN0igX42M3rhDD%2F-LqAhBZzrDSv6Xt78Eqc% (...)

(Trajectory aiming gizmo)

assets%2F-LAqwYovmUPn5V6CMeID%2F-LqAfnxN0igX42M3rhDD%2F-LqAi4DWv23aU-sH-BIm% (...)

(Aiming Mode: Trajectory)

The first property Mode allows to change between a Curved or a Straight line renderer. In either case, you can define an Offset in local space from where the line renderer will start.

Min Velocity and Max Velocity depend on the charge amount.

The Min Velocity and Max Velocity tell the minimum velocity at which the projectiles will be shot at each edge of the charged shot. In between values will be interpolated.
To know more about charged shots, see the Charging section.

The Resolution property defines how smooth the curved line renderer will be displayed. The curved gizmo is painted using Line Renderers, and the Resolution property defines the length of each segment in the Line Renderer.

The rest of the properties define how the Line Renderer will be displayed, including its Width, the Material used as well as where the faces of the Line Renderer will face.

Charging

Firing projectiles can be done via two different modes: Normal shots and Charged shots. This section deals with the later one.

assets%2F-LAqwYovmUPn5V6CMeID%2F-LqAo40yHQgJgdsSMlFe%2F-LqAogErQMJU42KWXDUW% (...)

(Charging section)
Charge Type is a property that affects both shooting modes; charged and normal shots. This property defines how this ammunition is shot.

  • Disable Charge: This ammunition can not shoot charged shots. It grays out the rest of the Charging section properties.
  • Require Charge: The ammo can only shoot charged shots. It will ignore any attempt to shoot normal shots.
  • Optional Charge: The ammo can both shoot charged shots and normal shots.

Min Charge Time is the minimum amount of time needed for a charged shot to be considered as such.

Charge Time property is the amount of time required to go from a charge of 0% to a 100% charged shot. This value can come from a Global Variable, so it can be dynamically set at runtime (for example, upgrading the weapon can yield in decreased duration).

Charge Value is an optional property that can be used to store the current charge of the weapon to be used at runtime. This is useful if you want, for example, to display a particle effect when the weapon is fully charged. This can be done by querying the current amount of charge stored in a particular variable.

Shooting

The Shooting section defines how bullets are fired. There are different shooting modes, each of them with its own particular set of properties: Projectile, Raycast, Raycast All, Trajectory Cast, SphereCast and SphereCastAll

assets%2F-LAqwYovmUPn5V6CMeID%2F-LqAsDSPKlQnf-_9zHHB%2F-LqAtxs8HGC0_pp62GGG% (...)

.
(Shooting Type: Projectile)

Projectile
Shooting Projectile Type is the easiest to set up. It instantiates a prefab, defined by Prefab Projectile, where the muzzle is and moves it forward.

If the projectile contains a Rigidbody component and the Aiming Mode is set to Trajectory, it will also apply force based on the Min Velocity and Max Velocity properties found at the Charging section.

Prefab Muzzle Flash instantiates a prefab at the muzzle position. This is typically used to play a particle effect.

assets%2F-LAqwYovmUPn5V6CMeID%2F-LqAsDSPKlQnf-_9zHHB%2F-LqAwwZuool5pSt1lmPE% (...)

(Shooting a Projectile with Trajectory aiming mode)

Bear in mind that the trajectory computed by the aiming mode doesn’t necessarily coincide 100% with where the projectile will land. See the GIF above how the arrow gets stuck just a few millimeters below where the trajectory indicated. This is due to the arrow being computed by a different system (Unity Physics engine) than the trajectory gizmo.

Raycast & Raycast All
Shooting Raycast and Raycast All modes (also know in other engines as hit-scan weapons) immediately hit the target as soon as the weapon is fired. This is done checking for any collisions between the muzzle and the direction of the muzzle.

assets%2F-LAqwYovmUPn5V6CMeID%2F-LqB-M6qR4XF03bJDmE8%2F-LqB02mjpoHODkgi7euP% (...)

(Shooting Type: Raycast)

Distance and Prefab Muzzle Flash properties define the maximum distance the collision check will reach. As soon as the scan starts, a prefab (if any) will get instantiated where the muzzle is.

If any object is returned by the collision check (or all of them if the Shoot Type is set to Raycast All), an instance of the Prefab Impact Effect will be instantiated.

Layer Mask allows to ignore objects that are part of the ignored layers. Very useful if you plan on making projectiles penetrate thin surfaces, such as paper walls or water.

If Push Force is greater than zero, each object returned by the hit-scan will be examined. If a Rigidbody is found, it will apply an impulse force at the contact point equal to this property’s value.

Shooting Trail allows to draw a trail that simulates the trail leftTEXTE APRES FILTRAGE
-  : liste tous les intertitres de l’article
-  : liste tous les documents de l’article sous forme de mini-vignette non cliquables. Avec deux paramètres :

width : largeur de la vignette en px,
raz : nombre de vignette sur une seule ligne. Juste après la Nième(raz) vignette, un
est inséré.

>