๐Ÿงพ
FPS Animation Framework
  • ๐Ÿ‘‹Welcome!
  • Workflow
    • ๐ŸฆพCharacter Rig
    • ๐Ÿ”ŒComponents
    • ๐Ÿ”ธProfiles and Layers
    • ๐Ÿ”—Linking
    • โž•Integration
    • โ–ถ๏ธPlaying Animations
    • ๐Ÿ’ปExtending the System
  • Demo Project
    • โœจResources
    • ๐ŸŽฎController
    • ๐Ÿ”ซWeapons and Items
    • โž•Attachment System
  • Fundamentals
    • ๐ŸฆพRig
    • โš™๏ธFramework Architecture
    • ๐Ÿ“‘Animator Profiles
    • ๐Ÿ“œAnimator Layer
    • ๐ŸŽฎInput System
    • ๐Ÿ”ถAnimator Layers
      • Weapon Layer General
      • Additive Layer
      • Ads Layer
      • Attach Hand Layer
      • Collision Layer
      • IK Layer
      • IK Motion Layer
      • Look Layer
      • Pose Offset Layer
      • Pose Sampler Layer
      • Sway Layer
      • View Layer
      • Blending Layer
      • Turn Layer
    • ๐Ÿ“šNew Animation Library
    • โš’๏ธTools
  • Recoil System
    • ๐Ÿ”ซRecoil Animation
    • ใ€ฝ๏ธRecoil Pattern
    • ๐Ÿ“นCamera Shake
  • Troubleshooting
    • โš ๏ธInitialization Warnings
    • โš ๏ธCan't Look Around
    • โš ๏ธWeapon Positioning
    • โš ๏ธWeapon is not moving
  • โš ๏ธAiming doesn't work
  • โš ๏ธTwisted feet when looking left/right
  • ๐ŸŒŒMisc
    • ๐Ÿ“œChangelog
      • 4.7.0 Update
Powered by GitBook
On this page
  • Properties
  • Integration
  1. Recoil System

Recoil Pattern

In this section you will learn about controller recoil.

PreviousRecoil AnimationNextCamera Shake

Last updated 1 year ago

Properties

Recoil Pattern represents the controller recoil, which is added to the character and camera rotation. This type of recoil is controller by the player, so it has a practical purpose.

The recoil is generated in a standalone component, make sure to add it to your character:

Recoil Settings define the actual recoil properties, such as damping, randomized targets for vertical/horizontal recoil, etc.

Delta Look Input Property represents the delta input value, which is related to the User Input Controller component we added previously in Componentssection.

Let's take a look at the Recoil Settings:

Horizontal/Vertical Recoil defines the randomized range.

Horizontal/Vertical Smoothing define the interpolation speed.

Damping defines how fast we should return to the initial screen position.

Integration

To add the recoil to your controller, make sure to grab a reference to the Recoil Pattern component first.

Then, make sure to access the component and add the recoil to the player inut:

if (_recoilPattern != null)
{
    _playerInput.y += deltaMouseY;
    _playerInput += _recoilPattern.GetRecoilDelta();
}

Then, call the Init method when a gun is equipped:

_recoilPattern.Init(recoilPatternSettings);

Finally, call the OnFireStart and OnFireStop methods:

_recoilPattern.OnFireStart(); // Call every shot.
_recoilPattern.OnFireEnd(); // Call when firing is cancelled.
ใ€ฝ๏ธ
Recoil Pattern.
Recoil Pattern settings.