🔫MShooteable
1.4.5
Overview
This component allows firing projectiles from a weapon.
Requirements
Here are the main steps you need to set up a Shooteable weapon properly:
Mode and Abilities
The Weapon mode will be set by the Weapon ID
Every shootable weapon needs at least Aim, Reload, and Fire animations. Those need to be set on the Mode Abilities and the Animator Controller.
Fire Ability: 101
Aim Ability: 97
Reload Ability: 96
Animations and Animator
The Animations for the Weapons are set on the Layer Upper Body. This allows them to move around, walk, run, crouch, jump, etc, and use the shootable weapon only on the upper body.
All the Animations have a duplicated version just in case the weapon needs to be used on the opposite hand:
Fire and Reload animations are optional. they can be skipped if [Has Fire Anim] and [Has Reload Anim] are set to false.
Projectile
The Shootable weapon needs a Projectile to release. You need to set a gameobject with the MProjectile component in the Projectile parameter
Shootable Parameters
Rate
The time delay between attacks. Once a weapon has attacked or released a projectile. it will wait until this time to release the next attack
Automatic
Continues to attack if the Main Input is still pressed down.
Charge time
Weapons can be charged before releasing the attack. E.g. The bow can bend to fire the arrow.
Charge Mechanic is only activated if the Projectile is set to Release on Attack Released
Charge time Curve
Evaluate the Charge value in the Curve
Max Charge
The max value of the charge that goes from 0 to this value. This value is sent to the Animator for the BlendTree of Charge animations
Charge Character Multiplier (CM)
Charge multiplier to Apply to the Character Charge Value (For the Animator Parameter)
Aim Origin
If the projectile is equipped before the attack is released. it will be parented to this Transform. E.g. The arrow is parented to the string before it is released.
Aim Action
Sets the way the weapon will handle the Aiming mechanic
Manual: The Weapon after is equipped it need to enable the Aiming State via Input
Automatic: As soon as the Weapon is equipped it will enter the Aiming State. Firing a projectile will also activate the aiming state
Ignore: Firing projectiles does not require aiming.
Aim Side
This dictates the position the Aim Profile Camera is going to be placed, In the left or Right side of the shoulder.
Aim Limit
The weapon will limit firing a projectile if the Angle formed between the Fire Direction and the Forward Direction of the Character. Usually, this is only applied when the character is not strafing or when is mounting the horse. E.g. The Bow cannot shoot arrows in a certain angle due to the harsh position .
The angle is dictated by the Aim Component Aim Horizontal parameter.
Use Aim Angle
Adds an extra angle in the Up Direction to fire the projectile. It creates a parabole trajectory.
Unequip On Aim
By Default if the weapon is aiming, it cannot be unequipped. Enable this parameter to interrupt the Aim and Unequip the weapon.
Has Fire Anim
When is set to true, the Character will call the Fire Abilty (x101) on the mode.
Equip Projectile
Set when the projectile is going to be equipped.
You can set multiple options but the projectile will be equipped on the first action. All other actions will be ignored.
Release Projectile
Sets when the projectile is going to be released.
Never: The projectile will be not released by me. (This is used when Invector weapons are the ones firing the projectiles)
On Attack Start: The projectile is released as soon as the Attack Input is pressed
On Attack Released: The projectile is released after Attack Input is released. ⭐This Option enables the Charge Weapon Mechanic
Release by Animation
The projectile is released by an animation Message. You will need to add a Weapon Behavior Directly to the animation.
Release Delay
If Release by animation is disabled. The projectile release will be delayed by this value
Projectile
Prefab of the actual projectile to shoot.
Projectile Parent
Transform that the projectile will be parented to.
Min and Max Force
Force to release the projectile. If the Charge mechanic is active the force will be influenced by the Charge normalized value.
Force Mode
Force type applied to the Projectile rigid body.
Gravity
Gravity transferred to the projectile. Set it to Vector3.zero if you want the projectile to travel with no gravity influence.
No Reload
Ignores completely the reload mechanic. The weapon will never run out of ammo
Has Reload Anim
The Weapon uses a reload animation to complete the reload mechanic. The Character will call the Reload Abilty (x096) on the mode.
Reload Time
Time elapsed since the reload action and animation were called, and the actual Reload logic where the ammo is updated.
Auto Reload
When true, the reload logic will be called when there's no ammo in the chamber
Chamber Size
Weapon chamber capacity. E.g. a Pistol can shoot 8 bullets without having to reload. Riffle can shoot 30 bullets without having to reload.
Ammo In Chamber
Current projectiles in the chamber. When this value is set to zero, you cannot fire any projectiles until you reload again
Total Ammo
The totalTotal amount of projectiles the weapon has available
General Parameters
General Parameters are shared between all Weapons. Check all parameters here.
Damage Parameters
IK Parameters
Extra Parameters
Last updated