- Home /
Question by
evildumdum · Aug 14, 2014 at 07:30 PM ·
javascripterror
Semi colon placement? unity error message
code: #pragma strict
var RotationSpeed = 100;
function Update ()
{
var rotation : float = Input.GetAxis ("Horizontal") * RotationSpeed;
Rotation *= Time.deltaTime;
UnityEngine.Rigidbody AddRelativeTorque (Vector3.back * Rotation);
}
error: Assets/BallControll.js(10,23): UCE0001: ';' expected. Insert a semicolon at the end.
umm where to i put the semicolon that unity is asking me to again?
Comment
UnityEngine.Rigidbody AddRelativeTorque is the problem, what do you want to do ?
I think the line should be :
rigidbody.AddRelativeTorque(Vector3.back * rotation);
EDIT : rotation and not Rotation !
Answer by Bunny83 · Aug 14, 2014 at 07:37 PM
I'm pretty sure you want something like this:
#pragma strict
var RotationSpeed = 100.0;
function FixedUpdate()
{
var rotation = Input.GetAxis ("Horizontal") * RotationSpeed;
rotation *= Time.deltaTime;
rigidbody.AddRelativeTorque (Vector3.back * rotation);
}
Note: You had used "Rotation" (with a capital "R") but your local variable was called "rotation". Also when dealing with forces you should use FixedUpdate.
Answer by smoggach · Aug 14, 2014 at 07:32 PM
UnityEngine.Rigidbody; AddRelativeTorque (Vector3.back * Rotation);