- Home /
Constant rotation?
How would I go about making an object spin constantly on its Y axis?
Answer by Eric5h5 · Oct 28, 2012 at 06:26 AM
Use transform.Rotate in Update.
In noob terms, please? I don't do much scripting, so how exactly would I use that, and how would I change the speed?
Please 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.)
Answer by phodges · Oct 28, 2012 at 03:30 PM
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);
}
Your answer
Follow this Question
Related Questions
How can I rotate RigidBody and not violate physics? 3 Answers
Planetoid Gravity 1 Answer
Transition between rotations 0 Answers
Rotating an object with inertia (quaternions driving me nuts) 0 Answers