Recoil Pattern Plugin Setup
Last updated
Last updated
The plugin consists of 3 main parts:
RecoilPattern asset - a special type of asset (URTRecoilPattern) that stores all parameters of the recoil pattern
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.
RecoilPattern Editor - special editor for recoil pattern
Recoil - weapon recoil. These are changes to the camera rotation after the shot is fired.
Relaxation - return of the camera rotation to the initial position, which was before the start of shooting
Open Content Browser context menu and select Gameplay->RecoilPattern
A collection of units(recoil units) that contains rotation for the camera
'Recoil' settings - parameters for camera rotation during shooting
'Relaxation' settings - parameters for camera rotation after the end of shooting (lowering/returning the camera to its position before the start of shooting)
Recoil unit location editor. All points are stored in a URTRecoilPatternUnitsCollection object inside a RecoilPattern
Window with settings for one recoil unit. It is only available when one recoil unit is selected.
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)
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.
RecoilPatternDataComponent stores a pattern applied during shooting
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
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
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)