I have only just started to use unity and i i have only started making a script but when i debug it, it says that i have 2 errors on line 5 and i can’t work them out can you help me.
#pragma strict
function Start ()
var accelerate : float = 3;
var turnSpeed : float = 3;
function Update ()
// this is the forward speed that will actually happen
var accelerateMoveAmount = input.GetAxis(“Vertical”)*forwardSpeed;
// actual turn amount
var turnAmount = input.GetAxis(“Horizontal”)*turnSpeed;
transform.Rotate(0,turnAmount,0);
Maybe it’s because you didn’t capitalize the first letter of “Input”? It should be
Input.GetAxis("vertical");
not
input.GetAxis("Vertical");
Also you should multiply it with Time.deltaTime, so that it won’t be influenced be the frame count any more. (Time.deltaTime is the time since the last frame)
Edit:
Ok… I’ll try to write the code how it should be… yours looks really chaotic, so I’m not sure if I’m able to.
#pragma strict
public var accelerate : float = 3; //this it unused!
public var turnSpeed : float = 3;
public var forwardSpeed : float = 3;
function Update () {
// this is the forward speed that will actually happen
var accelerateMoveAmount = Input.GetAxis("Vertical") * Time.deltaTime * forwardSpeed;
// actual turn amount
var turnAmount = Input.GetAxis("Horizontal") * Time.deltaTime * turnSpeed;
//I think you forgot the forward movement...
transform.position += transform.forward * accelerateMoveAmount;
transform.Rotate(0,turnAmount,0);
}
I hope this helps.
what u want to do ?? what is the problem ??