Guest User

ConstantRotate

a guest
Jun 20th, 2014
572
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ConstantRotate : MonoBehaviour {
  5.  
  6.     public float RotationsPerMinuteY=0;
  7.     public float RotationsPerMinuteX=0;
  8.     public float RotationsPerMinuteZ=0;
  9.  
  10.     void Update ()
  11.         {
  12.             Vector3 ConstantRotation = new Vector3 (0,0,0);
  13.            
  14.             if(RotationsPerMinuteX>0) {
  15.                 ConstantRotation.x=6.0f*RotationsPerMinuteX*Time.deltaTime;
  16.             }
  17.            
  18.             if(RotationsPerMinuteZ>0) {
  19.                 ConstantRotation.z=6.0f*RotationsPerMinuteZ*Time.deltaTime;
  20.             }
  21.            
  22.             if(RotationsPerMinuteY>0) {
  23.                 ConstantRotation.y=6.0f*RotationsPerMinuteY*Time.deltaTime;
  24.             }
  25.             transform.Rotate (ConstantRotation); //rotates 50 degrees per second around z axis
  26.         }
  27. }
RAW Paste Data