# Script problem for mosue look

Hey all can you please tell me what is wrong with this script thank you so much

``````public enum RotationAxis {MouseX = 0, MouseY = 1}

var RotationAxisRotationXY = RotationAxis.MouseX | RotationAxis.MouseY;

//We are defining the variables needed for our X axis motion. This will include

//Sensitivity and the minimum and maximum of the x axis rotation

var sensitivityX : float = 400f;

var minimumX : float = -360f;

var maximumX : float = 360f;

var RotationX : float = 0f;

var OriginalRotation : Quaternion;

var Game : Transform;

// Now lets set the variables for the y axis so the player can then look up and down

// using the mouse.

var RotationY : float = 0f;

var minimumY : float = -25f;

var maximumY : float = 25;

var sensitivityY : float = 400f;
``````

function Update () {

``````  if(RotationAxisRotationXY == RotationAxis.MouseX){

RotationX += Input.GetAxis("Mouse X") * sensitivityX * Time.deltaTime;

RotationX = ClampAngle (RotationX, minimumX, maximumX);

OriginalRotation = XQuaternion = Quaternion.AngleAxis (RotationX , Vector3.up);

transform.localRotation = OriginalRotation * XQuaternion;

}

if(RotationAxisRotationXY == RotationAxis.MouseY){

RotationY -= Input.GetAxis ("Mouse Y") * sensitivityY * Time.deltaTime;

RotationY = ClampAngle (RotationY, minimumY, maximumY);

OriginalRotation = YQuaternion = Quaternion.AngleAxis (RotationY, Vector3.right);

transform.localRotation = OriginalRotation * YQuaternion;

}
``````

}

``````static function ClampAngle (Angle, min, max): float {

if(Angle < -360){

Angle += 360;

}

if(Angle > 360){

Angle -= 360;

}

return Mathf.Clamp (Angle, min,max);

}
``````

I get the following errors :

Assets/FPSScripts/FpsMouseLook.js(77,26): BCE0051: Operator ‘<’ cannot be used with a left hand side of type ‘Object’ and a right hand side of type ‘int’.

Assets/FPSScripts/FpsMouseLook.js(78,31): BCE0051: Operator ‘+’ cannot be used with a left hand side of type ‘Object’ and a right hand side of type ‘int’.

Assets/FPSScripts/FpsMouseLook.js(81,26): BCE0051: Operator ‘>’ cannot be used with a left hand side of type ‘Object’ and a right hand side of type ‘int’.

Assets/FPSScripts/FpsMouseLook.js(83,31): BCE0051: Operator ‘-’ cannot be used with a left hand side of type ‘Object’ and a right hand side of type ‘int’.

Assets/FPSScripts/FpsMouseLook.js(86,36): BCE0004: Ambiguous reference ‘Clamp’: UnityEngine.Mathf.Clamp(int, int, int), UnityEngine.Mathf.Clamp(float, float, float).

You need to specify the types of all the variables involved.

``````static function ClampAngle (Angle : float, min : float, max : float): float {
``````

Otherwise, it will assume that all the variables are of type ‘Object’- which is as general as you can get.

This applies to all your functions and variables- you should never use dynamic typing when you have a choice.