- Home /
I'm working on a mouse look script but it isn't working. Help?
I have a script that isn't working properly. It says on line 6:
Assets/FPSScripts/MouseLook.js(7,24): BCE0043: Unexpected token: =.
and on line 7:
Assets/FPSScripts/MouseLook.js(7,25): UCE0001: ';' expected. Insert a semicolon at the end.
I see what it is saying, but I don't see my problem. Here is the script.
public enum RotationAxis {MouseX = 0, MouseY = 1}
var RotationAxisRotationXY = RotationAxis.MouseX || RotationAxis.MouseY;
var sensitivityX : float = 400f; var minimumX : = -360f; //This is line 6! var maximumX : = 360f; //Line 7 here. var RotationX : float = 0f;
var OriginalRotation : Quaternion;
var RotationY : float = 0f; var minimumY : float = -360f; var maximumY : float = 360f; 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;
} }
Format code when posting please. Also don't post comments as answers.
Answer by FLASHDENMARK · Aug 05, 2012 at 07:07 PM
public enum RotationAxis {MouseX = 0, MouseY = 1}
var RotationAxisRotationXY = RotationAxis.MouseX || RotationAxis.MouseY;
var sensitivityX : float = 400f;
var minimumX : float = -360f; //This is line 6!
var maximumX : float = 360f; //Line 7 here.
var RotationX : float = 0f;
var OriginalRotation : Quaternion;
var RotationY : float = 0f; var minimumY : float = -360f; var maximumY : float = 360f; 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;
} }
You had two :'s where they didn't belong. I guess you were trying to define it as a float, but missed the float part.
Your answer
Follow this Question
Related Questions
Need help with logic problem (JavaScript) 1 Answer
Expressions in statements must only be executed for their side-effects. 1 Answer
Trouble making money system 1 Answer
Error BCE0044 plz help 0 Answers
How to use if statement with var? 3 Answers