Weapons
Overview
NeoFPS currently supports three types of weapons: melee, thrown and modular firearms.
Weapon Types
Melee Weapons
Melee weapons are weapons such as clubs and swords that are held onto and swung at the enemy. For more information see Melee Weapons.
Thrown Weapons
Thrown weapons are items such as grenades and ninja stars that are stored in the character inventory and thrown by hand. For more information see Thrown Weapons.
Modular Firearms
Modular firearms are gun type weapons. They are assembled from a number of swappable modules that, together, model the behaviour of a firearm. For more information see Modular Firearms.
Wieldable Tools
Wieldable tools are items that are carried in the player character's hands and used with the primary or secondary fire buttons. They are assembled from a number of tool modules and actions. For more information see Wieldable Tools.
Explosions
The NeoFPS weapons can make use of a simple explosions system which deals damage and adds a repelling force to any objects in an explosion's blast radius. For more information see Explosions.
Demo Weapons
The following weapons are included in the samples in order to show off the different weapon features:
The baton is a simple demonstration of the melee weapons.
The pistol is a low caliber firearm with plenty of ammunition. It uses the basic features of the modular firearms.
The revolver is a high caliber, heavy hitting firearm. The trigger pull is quite heavy so firing can have a delay.
The shotgun is a pump action weapon with a conical spread. Shells are loaded into the weapon individually and the process can be aborted after the current round is inserted by pressing the fire button.
The assault rifle is a 5.56mm carbine with 3 fire modes: full auto, 3 round burst and semi-automatic.
The sniper rifle is a heavy caliber bolt-action rifle with a long range scope.
The grenade launcher is a single-shot break open launcher that fires 40mm high explosive grenades.
The fragmentation grenade is a thrown weapon. Pull the pin and wait 5 seconds for an explosion.
More demo weapons will be added in future updates.
Weapon-Camera Alignment
One of the most commonly asked support questions that people have is why their weapon is not aligned correctly to the camera.
The key thing to bear in mind with the NeoFPS weapons is that they will all be instantiated and stored under a single transform in the character hierarchy. For most characters this transform will be in the same position as the camera. This means that you should treat the root of the weapon hierarchy as the camera position.
The exception to this is when you have a full character body with arms that use IK to match the weapons. In this situation the item root that acts as parent to all the weapons should be attached to the upper chest bone (it can be raised to shoulder level or higher). If you do not do this then pitching the camera too far up or down will cause the weapon to swing away from the body and out of reach of the hands. For this situation it is usually best to treat the weapon root as the camera position for the initial setup and then offset the view-model to bring it into view at runtime and re-apply the offset once you re-enter edit mode.
In order to offset the view model to align it with the root of the character you need to move the view-model object itself. The root transform, pose transform (if it's not set to the root) and "WeaponSpring" transform will all have their position and rotation overwritten by the procedural animation systems. The view model usually sits under that "WeaponSpring" object.
Depending on how the weapon view-model animations are set up, this object might also have any offset you apply overwritten at runtime. If the root of the view-model has keyframes on its position or rotation then these will be applied as soon as the animation plays. Sometimes you can get around this simply by checking on "Root Motion" on the weapon Animator component. If the root object actually moves though, then it can be easier to add a new object in between the "Weapon Spring" and the view-model, and then offset that instead.
If your weapon is set up with an object in its view-model hierarchy that represents the camera position then there is a quick solution to aligning the weapon. On the weapon's main component inspector (MeleeWeapon, [ModularFirearm][ref2], [ThrownWeapon][ref3], [WieldableTool][ref4]) you will find a section called Origin Point with a property Match Transform. If you drag the camera object onto that field, then the view model will be realigned so that object is aligned with the weapon root. The value is not stored for later. It is used once to realign the objects and then forgotten.