x


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;

} }

more ▼

asked Aug 05 '12 at 06:45 PM

Doneyes gravatar image

Doneyes
33 5 13 31

Format code when posting please. Also don't post comments as answers.

Aug 05 '12 at 09:44 PM Eric5h5
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
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.

more ▼

answered Aug 05 '12 at 07:07 PM

OrangeLightning gravatar image

OrangeLightning
5.4k 47 57 112

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3447
x1944

asked: Aug 05 '12 at 06:45 PM

Seen: 164 times

Last Updated: Aug 05 '12 at 09:44 PM