Advanced
The full details for everything related to the firearm and how to use it.
Last updated
The full details for everything related to the firearm and how to use it.
Last updated
To add new model to the firearm you might want to expand the firearm game object until you find a game object called "Mesh" then drag your model into it. This is what it should look like:
Now you can remove the default cube.
Spray patterns are serious business in FPS games; they can be random or scripted, as seen in CS:GO and other titles. To add spray pattern into your firearm, you would first need to check the spray pattern page. If you already understand how to create and use a spray pattern, you would want to assgin it in the fileds "Spray Pattern" and "Aim Spray Pattern" in the firearm data.
You can assgin any of the default spray patterns for quick setup.
Before adding sounds, you would need to first read the audio system page.
To start adding sounds, you need to first find the firearm data file that you are using for your firearm. The firearm data's insepctor should look like this:
Expand the section "Audio" and make sure the toggle next to it is checked. This what you should see:
As explained on the audio system page, the audio system does not use audio clips, but rather audio profiles. Assign the appropriate profiles and press play.
There are two types of animations: keyframes (created in software such as Blender) and procedural.
Keyframe animations rely on Unity's animation system, which is explained in this playlist; you should watch it if you don't know how to utilize Unity's animation system.
You should already have animations such as (Reload, Idle), and those are the essential animations that you require; if you want more, you can add them later.
To start adding animations, first add animator component on the animated model you have added, like this:
The animations will operate if the animtor controller has the correct setup specified in the controller field. You can do one of these:
Duplicte one of the default controller and use it
Create it from scratch
In the first scenario, simply duplicate the animator controller of the default firearm type you want to create. Default animation controls are located at FPS-Framework\Assets\FPS Framework\Art\Animations\Animator Controllers\Controllers
In the second scenario, you would need to first build a new animator controller (Blank) and assign it to the controller field in the animator. Now go to your firearm and right click on the header of the component then click on Setup, then Animator Paramters, like this:
Now this is what you should see when you edit your newly created animtor controller:
As shown above, some parameters have been created. You can use them in your animation transitions to configure your animations. To create a reload animation using this method, for example, add a transition between your dile animations and reload animation with the condition of transitioning if IsReloading is true and transitioning back if IsReloading is false. You can also include Ammo in the equation with an empty reload animation and a normal reload animation.
The procedural animation system page explains how procedural animations work. There is an older system that is hardcoded, which makes the modification procedure easier for first-time users. To discover this earlier system, select the weapon game object and look for the component "FPS Motion". Inside this component, you will find premade animations ready to be used, such as the ADS and Sprinting. Change them to your liking. Note that the ADS settings will not be used if there's an attachment of the type sight in use (Active).
Effects such as muzzle flash and other particle system-based effects can be simply dragged and dropped into the firearm and will function properly; there is no need to assign anything for this purpose.
Other effects like, HUD, pickable version of the firearm, etc... are all found in the firearm data. Here are every single one of them.
Casing as an exmaple is a prefab that you need to assgin in the field "Casing" in the firearm data.
All default casing prefabs can be found at FPS-Framework\Assets\FPS Framework\Art\Models\Ammo.
To add crosshair to your firearm you migh want to take a look at crosshair page first. You need to assgin a crosshair into the field corsshair in the firearm data.
All default corsshair prefabs can be found at FPS-Framework\Assets\FPS Framework\Prefabs\HUD\Elements.
Weapon HUD such as ammo counters and reload warnings are all a part of the weapon HUD. You need to assgin a Weapon HUD (A prefab called Weapon HUD has it setup) prefab into the field "Canves" in the firearm data.
All default corsshair prefabs can be found at FPS-Framework\Assets\FPS Framework\Prefabs\HUD.
Replacement is a pickable version of the gun, you might want to take a look at pickable pages. You need to assgin the pickable version of your firearm into the field "Replacement" in your firearm data.
All default corsshair prefabs can be found at FPS-Framework\Assets\FPS Framework\Prefabs\Pickupables.
The name given to the "Pickupable" might be renamed to "Pickable" in the future
If you are using Hitscan shooting, you will notice a field called "Default Decal" in the weapon data. This field represents the default hit impact effect, which means that if there is no custom decal component on the hitted object, this prefab will be used as an impact effect.There is additional field associated with this decal, which is decal direction. This variable represents the direction of the decal based on the hit.normal value.
The firearm system is capable of far more than what has been described above. Here are more details.
The assigned ammo profile in the weapon data declares the type of each gun's ammo type. To create an ammo type, right click on the project window then Akila, then FPS Framework, then Weapons, then Ammo Profile. Now you can give a name to your ammo type and assgin into the firearm data.
Now the firearm can identify the ammo type, but this only happens when it finds it in the inventory, so you need to assign this newly created firearm data into your inventory's ammo profiles.
This field (Bolt Type) is critical if you want your gun to reload the chamber after every shot. In snipers or shotguns, you would want to shoot and then have the player wait for an animation to finish before allowing them to shoot again, which is exactly why this field exists.
If the field is set to "Gas Powered," this is ignored, and the player can shoot freely without waiting for anything to finish. On the other hand, if the field is set to "Manual," a new field will appear in the firearm data called "Recharging State Name," which is the name of the animation state that must be waited for to be able to shoot again. For exmaple if this field is set to "Reload" and this animation state is playing in the animator of your gun, the firearm will wait for this animation state to stop playing, only then the firearm can shoot again.
But how do you play that animation state after each shot? The firearm tries to play an animation state called "Fire" with each shot, so if you don't have one, you may create an empty animation state called "Fire" and transition from it to your "Recharging Chamber" animation state.