Adding an FPS Screenshake effect WHILE Enabling the Player to Look Around.

This question isn’t necessarily aimed toward making a screenshake effect in first-person as it is applying that screenshake function on top of the player being able to look around. I’m currently using the Unity First-Person Rigidbody Controller to move the camera and, when I apply any modification to the camera’s transform, the Controller simply cancels it out.

So, my question is this: How can I compound both the Controller AND the Screenshake function without the Controller overriding the Screenshake?

(Code is in C#)

You can try adding a dedicated events / weapon camera. Ugh, a camera that only renders the weapon and its projectiles… this camera can also be used to implement camerashake, earthquakes, and so on. So basically add another camera lol and make it a child of the main camera.

You’d have to change the code in the movement from its current:

  1. Take input
  2. Add input to player rotation
  3. Set new rotation

To something more like:

  1. Take input
  2. Add input to a stored rotation value
  3. Set rotation to the stored value
  4. If screen is shaking, add shake to this rotation

That way the shake is always on top of the input, and never affects the core value.

Wouldn’t it be easier to make the camera object a child of a shaker object? Meaning, you can shake the parent object any way you want, and the player can freely rotate the child camera object around.

That would work too. When given the choice, I tend to prefer adding complexity to scripts (where the complexity can be written out, documented, and understood) than to add it to the scene file (where future-me is left to puzzle out “why is this extra object here?”).

You should name things in your scene then :slight_smile:
Also, the shaker object could have a shaker script, while the child camera object could have a camera controller script. Should make things even more obvious.