- Home /
FPSMouseScript.js
Hi there, I am making a FPS game but when I watch youtube videos on the code for the FPSMouseScript it shows me errors when i click play. Please help as i have spent ages making a game for my school project and i want it to look good. Here is the script. (Error is at the bottom of the page)
 public enum RotationAxis {MouseX =3, MouseY = 1}
      
      var RotationAxisRotationXY = RotationAxis.MouseX || RotationAxis.MouseY;
      
      //Lets set the variables for the X axis so we can look around.
      
      var sensitivityX : float = 400f;
      
      var minimumX : float = -360f;
      
      var maximumX : float = 360f;
      
      var RotationX : float = 0f;
      
      var OriginalRotation : Quaternion;
      
      //Now that we have set the variables for he X axis, we need to do the same for the y axis
      //so you can look up and down.
      
      var Rotation : float = 0f;
      
      var minimumY : float = -360f;
      
      var maximumY : float = 360;
      
      var sensitivityY : float = 400f;
 
function Update () {
   if(RotationAxisRotationXY == RotationAxis.MouseX){
   
    RotationX += Input.GetAxis("Mouse X") * sensitivityX * Time.deltaTime;
    
       OriginalRotation = XQuaternion = Quaternion.AngleAxis (RotationX, Vector3.up);
       
       transform.localRotation = OriginalRotation * XQuaternion;
   
   }
   if(RotationAxisRotationXY == RotationAxis.MouseY){
   
   RotationY -= Input.GetAxis ("Mouse T") * 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 {
}
The Error is this (42,7) [Unknown Identifier: RotationY]
thanks for any useful comments.
Answer by jmparavicini · Oct 26, 2014 at 03:38 PM
If you still have this problem you have to change name of the var Rotation to var RotationY
Your answer
 
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Horror Game AI script recommendation? 1 Answer
I need help with a companion!!! 2 Answers
Help; I have two code errors need adivce 0 Answers
Teleport enemy after player collides with an object? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                