Notes:
- The “FPS_Procedural_Recoil_System” script can be attached anywhere in your controller / weapons.
- Make sure that your camera look script doesn’t override the camera rotation every update, see the “PC_Camera_Look” script in FPS Procedural Recoil System > Controller > Scripts for reference.
Get Started:
- Assign the “FPS_Procedural_Recoil_System” to your controller / weapon.
- Update the references such as Character Camera and Transform.
- Navigate to the script that makes your weapon fire, and add a new variable as such:
public FPS_Procedural_Recoil_System proceduralRecoilSystem;
- Now, after firing a shot, add this piece of code that will call the procedural recoil system AddRecoil() function.
You can find an example such as the “PC_Weapon” script in FPS Procedural Recoil System > Controller > Scripts.
proceduralRecoilSystem.AddRecoil();
- Now, navigate to your camera look script, you can find an example in FPS Procedural Recoil System > Controller > Scripts called **“PC_Camera_Look”.
- Create a variable again for the “FPS_Procedural_Recoil_System” as in step 3.
- After adding the rotation to your camera, call this function and pass through the rotation change:
proceduralRecoilSystem.OnCameraRotationChanged(yAngle, xAngle);
After these steps, the recoil system should work, if you want to also take advantage of the crouch and ads features, you can simply update the “isCrouching” and “isInADS” bools when your controller crouches or starts aiming down sight.
<aside>
<img src="https://prod-files-secure.s3.us-west-2.amazonaws.com/2c4ef7fa-9231-4b87-9845-45c3f459a03d/4cd65228-47d9-431c-9481-a58973f3a06e/discord-square-color-icon.png" alt="https://prod-files-secure.s3.us-west-2.amazonaws.com/2c4ef7fa-9231-4b87-9845-45c3f459a03d/4cd65228-47d9-431c-9481-a58973f3a06e/discord-square-color-icon.png" width="40px" /> Do you need help? — Join this Discord to reach out to the developer!
</aside>