Hello,
I just ran into another issue, I’m trying to rotate a needle to depict a speedometer, I’m getting the following error, see below:
Code:
var currentSpeed : float;
var SpeedNeedle : GameObject;
function Update () {
carsSpeed ();
Speedometer ();
}
function Speedometer () {
var speedFactor : float = currentSpeed;
var rotationAngle : float;
if (currentSpeed >= 0){
rotationAngle = Mathf.Lerp(0,180,speedFactor);
}
else {
rotationAngle = Mathf.Lerp(0,180,-speedFactor);
}
SpeedNeedle = transform.Rotate(0,0,rotationAngle, Space.Self);
}
function carsSpeed () {
//Getting current speed of the tire for engine sounds
currentSpeed = rigidbody.velocity.magnitude * 2.237 * Time.deltaTime;
}
Here is the Error:
[13769-screen+shot+2013-07-31+at+6.12.15+pm.png|13769]
Thanks for the help
Daniel
PS: I take the time to Mark and rate correct answers.