For some reason, it keeps telling me to add a semicolon at line (3,8) and (4,8) Referring to these two lines?
Line 3
Vector3 currentvertical = transform.TransformDirection(transform.up*Input.GetAxis(“Vertical”)*turnSpeed);
Line 4
Vector3 currenthorizontal = transform.TransformDirection(transform.right*Input.GetAxis(“Horizontal”)*turnSpeed);
Help would be great.
Full code:
var speed = 0.8;
var turnSpeed = 0.15;
var currentvertical : Vector3 = transform.TransformDirection(transform.up*Input.GetAxis("Vertical")*turnSpeed);
var currenthorizontal : Vector3 = transform.TransformDirection(transform.right*Input.GetAxis("Horizontal")*turnSpeed);
function Start () {
rigidbody.useGravity = false;
}
function Update () {
if (Input.GetButton("Jump")) { //Spacebar by default will make it move forward
rigidbody.AddRelativeForce (Vector3.forward*speed);
}
rigidbody.AddRelativeTorque(currenthorizontal);
// W key or the up arrow to turn upwards, S or the down arrow to turn downwards.
rigidbody.AddRelativeTorque(currentvertical);
// A or left arrow to turn left, D or right arrow to turn right.
}
Just checking, it's a .cs file right?
– DaveAMost likely when the compiler wants a semicolon at a place where it doesn't make sence you have something wrong in front of that line. The compiler reads your code like a book, it starts in line one and ends in the last one. If there's something wrong it can only tell at the point where your code stop making sence to him. It can't detect that you forget a closing bracket or something like that... The whole script or at least a few lines above the error would help... Feel free to edit your question at any time.
– Bunny83Sorry, fixed.
– blackmethod