⮞ Go to NeoFPS.com

    Show / Hide Table of Contents

    BetterSpringRecoilHandler MonoBehaviour

    Overview

    The BetterSpringRecoilHandler module controls a FirearmRecoilEffect and a CharacterRecoilEffect behaviour to apply procedural recoil animation to the weapon and player character.

    Inspector

    BetterSpringRecoilHandler

    Properties

    Name Type Description
    Start Active Boolean Should this module register as the active recoil handler immediately on start.
    Activation Mode Dropdown How does module activation work. Options are: Component means the component will be enabled / disabled - use this when you have multiple modules on an object such as the firearm root. GameObject activates / deactivates the object - use this for attachments where you want the geo to appear/disappear.
    On Recoil [UnityEvent][unity-event] An event that fires every time the weapon recoils.
    Hip Accuracy Kick Float The accuracy decrement per shot in hip fire mode (accuracy has a 0-1 range).
    Hip Accuracy Recover Float The accuracy recovered per second in hip fire mode (accuracy has a 0-1 range).
    Sighted Accuracy Kick Float The accuracy decrement per shot in sighted fire mode (accuracy has a 0-1 range).
    Sighted Accuracy Recover Float The accuracy recovered per second in sighted fire mode (accuracy has a 0-1 range).
    Additive Transform AdditiveTransformHandler The additive transform handler which manages the firearm spring effects. If this is not set then it will be grabbed from the child hierarchy in awake.

    Recoil Profiles

    The BetterSpringRecoilHandler module has a recoil profile for aiming down sights and for hip fire. Each of these have the following properties:

    Name Type Description
    Recoil Angle Float The angle to rotate the gun on recoil (before modifiers).
    Spring Return Float How much of the head/body recoil should return to its original position. Values below 1 will redirect some of the recoil to the character's aim controller.
    Wander Float The maximum amount of side to side movement during a recoil. At wander = 1, the gun can rotate anything up to 90 degrees from up. At 0, the gun will only rotate upwards.
    Horizontal Multiplier Float A multiplier applied to any horizontal rotation of the recoil.
    Vertical Divergence Float The split between head and weapon recoil. At 0, the head/body will rotate, and the firearm will move with it. At 1, the firearm will rotate and the head/body will remain still.
    Horizontal Divergence Float The split between head and weapon recoil. At 0, the head/body will rotate, and the firearm will move with it. At 1, the firearm will rotate and the head/body will remain still.
    Push Back Float The distance the firearm will be pushed backwards each shot.
    Max Push Back Float The maximum distance the firearm can be pushed back.
    Jiggle Float The amount of jiggle (spring rotation around the z-axis) to be applied to the firearm.
    Duration Float The time taken for the head and firearm to return to their pre-recoil state.
    Recoil Spring Curve AnimationCurve The animation curve used to drive the amount of recoil rotation over the duration of the recoil effect.
    Weapon Jiggle Curve AnimationCurve The animation curve used to drive the firearm's jiggle rotation over the duration of the recoil effect.
    Weapon Push Curve AnimationCurve The animation curve used to drive the firearm's push-back over the duration of the recoil effect.

    See Also

    Modular Firearms

    FirearmRecoilEffect

    CharacterRecoilEffect

    Additive Transforms and Effects

    Back to top Copyright © 2019 Yondernauts Game Studios Ltd
    Generated with DocFX