Recoil Mouse Look Problem

Hi all, i have one problem, i’m currently working on project of FPS game,i have a script of gun , with recoil, now the script is this:

var playerCamera : Camera;
......
function Shoot()
{
.....
Recoil();
.....
}

function Recoil()
{
playerCamera.transform.localEulerAngles -= Vector3.right;
}

Ok this code moves the camera in up, but on camera is attached mouse look on y axes, and it doesn’t work or work but with problem return in under. If i make the mouse look on x axes it work very well. Please help me!
ps: Sorry for my english, but i’m italian :stuck_out_tongue:

If your camera is being controlled by the MouseLook script, that will override anything you do to the camera’s position yourself. You need to move the MouseLook target instead. If that’s your player, or something else you don’t want to move, you’ll need to add an ‘indirection’ object – something that is a child of your current target, so it moves with the target but can be offset from it – and point MouseLook at that.

Thanks for reply, Can you explain please? Should I put in another Mouselook gameObject? But after more than one should not move the camera?

Oops, my mistake, I just checked and realized MouseLook doesn’t have a target – I was thinking of MouseOrbit. OK, so your script’s ‘playerCamera’ variable is set to point to the camera that has a MouseLook component applied to it? MouseLook updates the camera’s rotation in Update(), and resets localEulerAngles.x. To change the base value, you’d need to update MouseLook.rotationY in your gun recoil script.

THANKS THANKS THANKS THANKS!!! I LOVE YOU!!! xD IT WORK!!! THANKS AGAIN ;AGAIN AND AGAIN!