x


BCE0044 Error

Hello,

I'm getting an Error in Unity 3D. My first error was: "; Expected, please insert a semicolon". So thats what I Did in the correct spot. This was the error:

alt text

I Fixed that problem perfectly, but then. That created another error. This is a picture of it:

alt text

What am I Doing wrong. This is the script I'm trying to et working. Its a Mouse Look script:

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

var RotationAxisRotationXY : RotationAxis = RotationAxis.mouseX || RotationAxis.mouseY;

//We are defining the variables needed for our X axis motion. This will include
//Sensitivity and the minimum and maximum for the x axis rotation.

var sensitivityX : float = 400f;

var maximumX : float = -360f;

var maximunX : float = 360f;

var RotationX : float = 0f;

var OriginalRotation : Quaternion;

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

var RotationY : float = 0f;

var minimumY : float = -360;

var maximun : float = 360;

var sensitivityY : float = 400f;

var YQuaternion : Quaternion;

var XQuaternion : Quaternion;

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: float, min: float, max: float): float {

if(Angle < -360);{

Angle += 360;

} if(Angle > 360);{

Angle -= 360;{ }

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

more ▼

asked Aug 08 '12 at 09:25 AM

Raxis gravatar image

Raxis
27 3 11 14

In the console, double click on the error so it will highlight the exact place in the script where the error happens.

Aug 08 '12 at 09:27 AM fafase
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

In your function ClampAngle, there is a weird "{}" thing in the if (Angle > 360). i think you want to delete the "{" after Angle -= 360; and delete one of the "}" at the end of the method.

EDIT : There is a ";" just after "if (Angle<360)" and "if (Angle>360)", delete them !

more ▼

answered Aug 08 '12 at 10:01 AM

KiraSensei gravatar image

KiraSensei
602 12 24 34

Nope, Thats not it.

Aug 08 '12 at 10:27 AM Raxis

But why do you have these ? the return function is in a "if". Look at my answer again, I edited it.

Aug 08 '12 at 11:35 AM KiraSensei
(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:

x3316
x1938
x1937
x162

asked: Aug 08 '12 at 09:25 AM

Seen: 261 times

Last Updated: Aug 08 '12 at 11:37 AM