Error with gun aim to the mouse

Okey , my problem is when i’m aiming to the cursor , in 2d mode , the gun move in all axes.

  • Wanted movement
  • List item

Only in the 2d dimension …

PD1: I was searching a lot of things and nothing can help me.

PD2: This movement is like the game Rochard , but only with a 3d model , only rotation no hips , etc…

This might help. I dont know what axis angle you are trying to clamp… :frowning:

function Update() {

var input = Input.GetAxis("Mouse Y");
   

if(input != 0) {
    //We really only need to do the rest if we actually moved some.
    angles.x += rotationVelocity * Time.deltaTime * input;

    angles.x = Mathf.Clamp(angles.x, 0, 0);

    transform.eulerAngles.x = angles.x;

}
}