Advertisement
Selzier

RotateConstant

Aug 15th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class RotateConstant : MonoBehaviour {
  5.  
  6.     private bool pointerEnter;
  7.    
  8.     // Update is called once per frame
  9.     void Update () {
  10.         if (pointerEnter) {
  11.             transform.Rotate(0, 0, 20 * Time.deltaTime); //rotates 20 degrees per second around z axis
  12.         }
  13.     }
  14.  
  15.     public void PointerEnter() {
  16.         pointerEnter = true;
  17.     }
  18.     public void PointerExit() {
  19.         pointerEnter = false;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement