I'm trying to rotate a GameObject with loop infinity but doesn't work, the rotation stops in 1, I'd Like to know how to do the infinity rotation ? thanks
function Update () {
transform.rotation.y = transform.rotation.y + 0.01;
}
function Awake () {
transform.rotation = Quaternion.identity;
}
If I understand correctly then you want an object to infinitely spin around on the y-axis?
If so then use something like this:
var degreesPerSecond : float = 20.0;
function Update()
{
transform.Rotate(Vector3.up * degreesPerSecond * Time.deltaTime, Space.Self);
}
This will rotate the object 20 degrees per second. Change the degreesPerSecond var until you get a nice speed.
taoa
February 8, 2011, 4:35pm
2
You're directly modifying the y component of the rotation quaternion, which is NOT and angle.
Use this instead:
transform.rotation.eulerAngles.y = transform.rotation.eulerAngles.y + 0.01;