Attachment System
A detailed guide on how to use the attachment system.
Last updated
A detailed guide on how to use the attachment system.
Last updated
How it works?
Attachmet and FirearmAttachmentManager are the two main parts of the very simple attachment system. The Firearm Attachment Manager, or FAM for short, does little more than keep track of the attachment names in a single container. Its additional task is to compute the total changes expressed as a percentage for each of the attachments' defined attributes, such as ADS Speed, all of these attributes are avaliable in the component "AttachementBehavior". This is the inspector of "AttachementBehavior":
For the attachment component to function, one component must be attached to the same game object able to be able to tell the attachment component what to do, be it sight, muzzle, or something else entirely. This requied component could be any of the compnents that has the prefix Attachment in it as an example AttachmentSight or AttachmentMuzzle, etc...
To create a new attachment first make sure to have the component your firearm game object should have the component FirearmAttachmentsManager. Like this:
The FPS Framework has a lot of creators; these creators are responsible for creating things like Weapons, characters, and UI. To access the Attachment creator, right-click on the hierarchy. This will show a menu. Click on the menu Akila, then FPS Framework, then Firearm, then Attachment, then click on the type you want to create like this:
To add a 3D mesh drag it and drop into your newly created attachment game object like this:
Name
The children of this attachment will be enabled if the name of the attachment that the weapon is checking matches the name of the attachment type; if not, all of the children will be disabled.
Damage
The amount of effect this attachment has on the damage of the target gun.
Spread
The amount of effect this attachment has on the spread of the target gun.
Firerate
The amount of effect this attachment has on the firerate of the target gun.
Range
The amount of effect this attachment has on the range of the target gun.
Muzzle velocity
The amount of effect this attachment has on the muzzle velocity of the target gun.
Recoil
The amount of effect this attachment has on the recoil (Camera) of the target gun.
Visual Recoil
The amount of effect this attachment has on the recoil (Gun movement) of the target gun.
Aim speed
The amount of effect this attachment has on the aim speed of the target gun.
Different attachments are specified by the component associated with the component "Attachment," which means that if "Attachment Sight" is associated with the component "Attachment," the attachment will be sight type and so on. Attachment types are (1. AttachmentSight 2. Attachment Muzzle 3. AttachmentMagazine 4. AttachmentStock)