problem with camera movement

hi all,
really need help with this since i’ve tryied so many things and none worked…
well what i want to do is rotate the camera only on the XX axis and the body(player) on the YY axis
the problem is that when it reaches a certain angle it inverts the mouse movement.

the script is attatch to the camera

here is the hierarchi of the player:
Player ----
camera
object

here is the script :

@script AddComponentMenu ("Camera-Control/Mouse Look JS") 
enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 } 
var axes = RotationAxes.MouseXAndY; 
var sensitivityX : float = 8; 
var sensitivityY : float = 8; 

var minimumX : float = -360; 
var maximumX : float = 360; 

var minimumY : float = -60; 
var maximumY : float = 60; 

var rotationX : float = 0; 
var rotationY : float = 0; 

var Player : GameObject;

private var originalRotation : Quaternion; 

function Update () { 
   if (axes == RotationAxes.MouseXAndY) { 
      rotationX += Input.GetAxis("Mouse X") * sensitivityX; 
      rotationY += Input.GetAxis("Mouse Y") * sensitivityY; 

      rotationX = ClampAngle (rotationX, minimumX, maximumX); 
      rotationY = ClampAngle (rotationY, minimumY, maximumY); 
       
      var xQuaternion = Quaternion.AngleAxis (rotationX, Vector3.up); 
      var yQuaternion = Quaternion.AngleAxis (rotationY, Vector3.left); 
>-------------------------
	  var Rot = originalRotation * xQuaternion * yQuaternion;
      transform.localRotation.x = Rot.x;
	  Player.transform.localRotation.y = Rot.y;
<-------------------------
   } 
   else if (axes == RotationAxes.MouseX) { 
      rotationX += Input.GetAxis("Mouse X") * sensitivityX; 
      rotationX = ClampAngle (rotationX, minimumX, maximumX); 

      xQuaternion = Quaternion.AngleAxis (rotationX, Vector3.up); 
      transform.localRotation = originalRotation * xQuaternion; 
   } 
   else { 
      rotationY += Input.GetAxis("Mouse Y") * sensitivityY; 
      rotationY = ClampAngle (rotationY, minimumY, maximumY); 

      yQuaternion = Quaternion.AngleAxis (rotationY, Vector3.left); 
>-----------------
      Player.transform.localRotation = originalRotation * yQuaternion; 
<-----------------
   }
   // Adjust Aming Speed
	if ( Input.GetButton("Sights")){
		Aiming ();
	}
	else if ( Input.GetButton("Sights")){
		Normal();
	}
	
	
} 

function Start () { 
   if (rigidbody) 
      rigidbody.freezeRotation = true; 
   originalRotation = transform.localRotation; 

} 

static function ClampAngle (angle : float, min : float, max : float) : float { 
   if (angle < -360.0) 
      angle += 360.0; 
   if (angle > 360.0) 
      angle -= 360.0; 
   return Mathf.Clamp (angle, min, max); 
}

function Aiming ()
{
	sensitivityX = 1;
	sensitivityY = 1;
}

function Normal ()
{
	sensitivityX = 8;
	sensitivityY = 8;
}

between the >---- <---- is the code that i changed

well really hope you can help me with this
thanks in advance

anyone?

What does ‘XX axis’ and ‘YY axis’ mean?

it’s the X and Y axis

I doubt you really want to be modifying the individual elements of the rotation quaternions as you’re doing currently (remember, the elements of the ‘rotation’ and ‘localRotation’ fields are not angles).

hmm…
do you have any tips on how to do this?