The Recoil module quickly changes the orientation of the camera to simulate recoil, such as when shooting a gun. Recoil is most commonly used for any kind of shooting game.

🔫 Settings

The following settings are available to customize:

  • Decay Rate: How quickly the recoil returns to zero. The higher the value, the faster the recoil will return to zero.

🖱️ Usage

It is up to you to manually apply a given amount of recoil to the camera. It felt more appropriate to handle that logic in a weapon/gun system rather than in the camera system. All that needs to be done is to increase the amount property, as follows:

// get a reference to the module
Recoil recoil = cameraController.GetModule<Recoil>();

// apply some amount based on the weapon
recoil.amount += Vector2.up * 5f;

🧰 Scripting API