How to use Cover System
Last updated
Last updated
The Cover System works very simply, it only needs two scripts, the JU Cover Controller which is added to the player character and the Cover Trigger which is added to a trigger close to a wall to create a cover area.
At the moment the Cover System only works natively for the Player, but in the future I will adapt it for AIs
Add a JU Cover Controller to your player
Create a Cover Trigger
Play a little
you can use Prevent Gun Clipping Script to improve the cover experience preventing the weapon from clipping through walls.
The JU Cover Controller has several interesting parameters to better adapt to your game's style, It already works plug and play but you might like to change some parameters:
Cover Trigger tag
Tag to detect Cover trigger box
Current Cover Trigger
Cover trigger currently detected
Enable Cover
Enable Cover
Auto Mode
Causes the Cover System to start automatically without needing to press a button, based on movement and angle to the wall, when deactivated the Cover System will use the interaction button (F) to start
Sneak Speed
Movement speed in Cover
Rotation Speed
Rotation speed to Cover
Crouched Sneak Speed
Crouched movement speed in Cover
Corner Position Offset
It is the character's adjustment position on a corner when in Fire Mode
Wall Offset Position
Distance of the wall(or the center of the Cover Trigger)
Wall Offset Position in FireMode
Distance of the wall(or the center of the Cover Trigger) when in Fire Mode, It is useful for a better position pointing a weapon
Cover Animator Parameter
It is the name of the parameter in the Animator Controller
Camera Right Offset
Camera position ajustment on Right/Horizontal Axis when in Cover, this parameter works for right and left adjustment
Switch Side Speed
Camera position adjustment transition speed
Spine Inclination
Spine bone lean when in Cover, this parameter works for right and left adjustment
Left Weapon Inclination Intensity
Left angle adjustment of the Item Aim Rotation Pivot when in Fire Mode and Cover
Right Weapon Inclination Intensity
Left angle adjustment of the Item Aim Rotation Pivot when in Fire Mode and Cover
Lean Axis
🔴 It is the spine inclination axis, the default is the front axis (0,0,1) but you may have to change the axis due to your character's rig, you can test and see which works best on your character
Fire Mode Duration In Cover
Customized Fire Mode duration for the Cover System, it is useful if you want the character to cover faster so as not to take damage
On Cover / On Exit Cover
These are events called in these situations, these events are useful if you want to call any methods
The Cover Trigger is actually a very simple script, it basically serves for the JU Cover Controller to receive essential information from the trigger in a practical way.
The Cover Trigger has only one variable, which is used to inform the JU Cover Controller that the cover is only possible by crouching.
There is already a function for creating Cover Triggers as you saw above, but if you want to create one manually, a Cover Trigger requires the settings marked in red below: