The ModularFirearm behaviour manages all of the modules that make up a firearm.
|Animator||Animator||The weapon geometry animator (optional).|
|Fire Anim Trigger||String||The AnimatorController trigger key for the fire animation (blank = no animation).|
|Raise Delay Type||Dropdown||The delay type for raising the weapon (you can use FirearmAnimEventsHandler to tie delays to animation). Options are None, Elapsed Time, External Trigger.|
|Raise Duration||Float||The duration in seconds for raising the weapon.|
|Raise Anim Trigger||String||The AnimatorController trigger key for the weapon raise animation (blank = no animation).|
|Dry Fire Sound||AudioClip||The audio clip to play if attempting to fire while empty.|
|Weapon Raise Sound||AudioClip||The audio clip to play when the weapon is drawn.|
The NeoFPS weapons assume that the camera is placed at the origin. For many assets or 3rd party weapons, the origin is at the character feet or hips and the camera is a child object of the weapon's hierarchy. To align the object to correctly work with NeoFPS you can drag the camera object of the weapon into the Match Transform field. This will move everything below the spring object to match up.
Modular Firearm Details
The modular firearm details section assists in setting up a modular firearm. It displays the current state of the firearm along with the attached modules, and allows you to quickly add modules to the firearm.
When the ModularFirearm behaviour is first added to an object, the details section will display options for quick setup. This is only available if the object is placed in a scene. If it is accessed as a prefab in the project hierarchy, then these options will not appear because of issues with modifying prefab object heirarchies via scripts.
This is used to set up the firearm hierarchy and attach render geometry. It has the following properties:
|Use Inventory||Dropdown||Which of the inventory implementations do you want the firearm to use. Choosing the Custom option does not add an inventory wieldable behaviour, meaning that you will need to add your own solution.|
|Use Standard Input||Boolean||Should the firearm use the standard NeoFPS input handler. Switch this off if you wan to add your own custom input handler.|
|Weapon Geometry||GameObject||This value is a prefab or model that you want to use to represent the first person weapon. If the object does not contain a mesh renderer or skinned mesh renderer in its hierarchy then it will cause an error. There is also a warning if the object has no animator in its hierarchy, though this is not compulsary.|
With a valid weapon geometry object selected, the Set Up Firearm button will be available. Pressing this will create a spring object set up with procedural animation behaviours for handling things like recoil and weapon bob, and then will copy the weapon geometry under this.
If the firearm already has child objects then the details section will instead show the modules options:
To add a firearm module click the relevant dropdown button and select the desired module from the menu. If a module is required for a firearm to operate then the info section at the top of the modular firearm details will display an error if that module is not attached. The firearm can also have multiple modules of each type, though only one should be set to start active.
Each of the attached modules can also report back any errors to the firearm they are attached to, and broken modules will be displayed as red in this list.