I’m trying to set a specific rotation, not continuously spin. I have the following code in Update. How can I set the transform rotation, thanks.
speed = car.velocity.magnitude * 2.237f;
needle.transform.Rotate(Vector3.forward, speed);
I’m trying to set a specific rotation, not continuously spin. I have the following code in Update. How can I set the transform rotation, thanks.
speed = car.velocity.magnitude * 2.237f;
needle.transform.Rotate(Vector3.forward, speed);
Rotate() does that, it rotates the gameobject/transform
if you want to set a rotation you need to set the rotation property
transform.rotation = ...
(note the R and r in the function and property)
transform.rotation = Quaternion.Euler(new Vector3(180f, 0f, 0f));
will set the rotation directly ( 0f - 360f )