Created
October 29, 2017 10:08
-
-
Save ditzel/0ca750827c590e695345b46a6a7be183 to your computer and use it in GitHub Desktop.
Rotates an object (rpm can be specifed)
This file contains 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
/* | |
* RotateObject | |
* | |
* Author: Daniel Erdmann | |
* | |
* 1. Add this File to you Project | |
* | |
* 2. Put it on an object | |
* | |
*/ | |
using UnityEngine; | |
public class RotateObject : MonoBehaviour | |
{ | |
/// <summary> | |
/// Rotation in RPM | |
/// </summary> | |
public float RPM = 1; | |
// Use this for initialization | |
void Start() | |
{ | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
transform.Rotate(Vector3.up, (Time.deltaTime / 60f) * 360f * RPM); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment