Handling Recoil

The Recoil component is responsible for applying camera or weapon shake whenever the weapon is fired. It should be attached to the Recoil GameObject under your weapon prefab. It listens to the barrel’s shots by itself, so it doesn’t need to be linked in the Weapon script.

🔗 Integration

To enable recoil in your weapon:

  1. Make sure your weapon prefab has a child GameObject named Recoil.
  2. Attach the Recoil script to that object.
  3. Leave its Barrel field empty to follow every barrel under it, or assign one barrel to follow only that one.
  4. Test your weapon and tweak values to get the desired effect. “Project Structure”