đŸ”Ģ
Recoil Pattern
  • 🔍Overview
  • 🤠Quick Start
  • âšī¸Recoil Pattern Plugin Setup
  • đŸ—’ī¸Recoil Pattern Parameters
  • Changelog
Powered by GitBook
On this page
  • The main parts of the plugin
  • The plugin Terms
  • The procedure for integrating and setting up a plugin in a project
  • Create and open a RecoilPattern asset
  • Add the RecoilPatternDataComponent to your weapon
  • Add the RTRecoilPatternControllerComponent to your controller
  • Debug

Recoil Pattern Plugin Setup

PreviousQuick StartNextRecoil Pattern Parameters

Last updated 2 years ago

The main parts of the plugin

The plugin consists of 3 main parts:

  1. RecoilPattern asset - a special type of asset (URTRecoilPattern) that stores all parameters of the recoil pattern

  2. RecoilPatternComponent - a actor component(URTRecoilPatternComponent), which is responsible for the logic of applying the recoil using parameters from the RecoilPattern asset. The result of it work is to change the rotation of the camera during and after shooting.

  3. RecoilPattern Editor - special editor for recoil pattern

The plugin Terms

  1. Recoil - weapon recoil. These are changes to the camera rotation after the shot is fired.

  2. Relaxation - return of the camera rotation to the initial position, which was before the start of shooting

The procedure for integrating and setting up a plugin in a project

Create and open a RecoilPattern asset

Open Content Browser context menu and select Gameplay->RecoilPattern

The asset consists of 3 main parts:

  1. A collection of units(recoil units) that contains rotation for the camera

  2. 'Recoil' settings - parameters for camera rotation during shooting

  3. 'Relaxation' settings - parameters for camera rotation after the end of shooting (lowering/returning the camera to its position before the start of shooting)

The editor is divided into 4 windows

  1. Recoil unit location editor. All points are stored in a URTRecoilPatternUnitsCollection object inside a RecoilPattern

  2. Window with settings for one recoil unit. It is only available when one recoil unit is selected.

  3. Window with units collection settings. These settings allow you to enable automatic sorting of recoil units depending on their location relative to each other (these settings are stored in URTRecoilPatternUnitsCollection)

  4. Window with settings for camera rotation (these settings are stored in URTRecoilPattern)

You can get information about any parameter from the tooltip when you hover over it with the mouse.

Add the RecoilPatternDataComponent to your weapon

RecoilPatternDataComponent stores a pattern applied during shooting

Setup

Set a RecoilPattern to component in Details panel

While shooting, you need to call 3 functions from the component:

  • StartShooting - during the start of shooting

  • Shot - after each shot

  • EndShooting - after the end of shooting

All of these functions redirect calls to RTRecoilPatternControllerComponent

For set new recoil pattern in runtime use function SetRecoilPattern

For stop recoil or relexation use functions StopRecoil and StopRelaxation

Important: For the component to work correctly, make sure that the owner of your weapon is Pawn or Controller (you can set the owner when the weapon spawns, or using the SetOwner function) or override GetRecoilPatternControllerComponent function and return correct RTRecoilPatternControllerComponent

Add the RTRecoilPatternControllerComponent to your controller

RTRecoilPatternControllerComponent implements the logic for applying the recoil pattern.

This component must be stored in the controller (or any other persistent class during the match).

At the start of firing, RecoilPatternDataComponent each time tells RTRecoilPatternControllerComponent which pattern to use for firing

Important: For the component to work correctly, make sure that the owner of your component is Controller or override GetController function and return correct controller

Debug

The debug functionality is implemented in RTRecoilPatternControllerComponent

The plugin supports displaying debug information on the screen. To enable set "Enable Debug" flag in component

For enable shot hits debug set "Draw Shot Hut" in component and call NotifyDebugShotHit function on your projectile hit(or after line trace)

âšī¸