How would I go about making an object spin constantly on its Y axis?
2 Answers
2Use transform.Rotate in Update.
The docs can be found here:
http://docs.unity3d.com/Documentation/ScriptReference/Transform.Rotate.html
Just for the sake of it, here’s a simple script that will spin an object around on its y-axis.
#pragma strict
var rotationSpeed : float = 360f; // Speed, in degrees per second
function Update () {
transform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime);
}
In noob terms, please? I don't do much scripting, so how exactly would I use that, and how would I change the speed?
– CubicApocalypsePlease read the docs, they have code examples which in this case do exactly what you're asking for. (Well, almost--just multiply by a speed variable.)
– Eric5h5