Skip to content

Instantly share code, notes, and snippets.

@ditzel
Created October 29, 2017 10:08
Show Gist options
  • Save ditzel/0ca750827c590e695345b46a6a7be183 to your computer and use it in GitHub Desktop.
Save ditzel/0ca750827c590e695345b46a6a7be183 to your computer and use it in GitHub Desktop.
Rotates an object (rpm can be specifed)
/*
* 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