Created
June 21, 2011 00:54
-
-
Save greggraham/1036987 to your computer and use it in GitHub Desktop.
Unity script for simple object rotation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simple rotation around the Y-axis | |
var speed = 5.0; | |
function Update () { | |
transform.Rotate(0, speed*Time.deltaTime, 0); | |
} |
hey dude how can i use it
@QeustionHub, I don't know that I really remember. I posted this 9 years ago I'm sure to answer someone's question, but I've hardly used Unity since then. The main point is to use Time.deltaTime to get a continuously increasing value for rotation, but you probably need to multiply it by a value (the variable "speed") to scale it to the speed you want. The variable "transform" would be associated with some object in your Unity world. I expect the three parameters for Rotate are the X, Y, and Z axis rotation amounts. In this example, you are only changing the Y rotation, keeping X and Z at 0.
Thanks dude
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice script