Adding some recoil to the Camera (FPS)

I just want to add some recoil to the camera, but I can’t find a working script. It’s an fps, so I take my mouse axis to rotate the camera. And now I want a pushback to the top, so that the camera looks into the sky after shooting a whole clip. It should be pretty easy, just add some amount to the axis, but it isn’t working for me.

I’ve got something like this from another post, but it just does nothing for me… I got a feeling that my axis is locked in some way, I’m using the “MouseLook” from the standart assets.

transform.Rotate( recoil * Time.deltaTime, 0, 0 ) ;


This Script is working partially, but I think I reactivate the MouseLook too fast after the Rotate, so that the Mouse just jumps back to the starting position.

	mouseLook.enabled = false;
	transform.Rotate (-5, 0, 0);
	mouseLook.enabled = true;

You need to disable the mouselook script, or at least the part where the camera rotation is affected by the mouse axis, temporarily while the recoild takes effect, and enable it afterwards. You can use a simple bool for this.