AutoRotation.cs 576 B

123456789101112131415161718192021222324
  1. namespace VRTK.Examples
  2. {
  3. using UnityEngine;
  4. public class AutoRotation : MonoBehaviour
  5. {
  6. [Tooltip("Angular velocity in degrees per seconds")]
  7. public float degPerSec = 60.0f;
  8. [Tooltip("Rotation axis")]
  9. public Vector3 rotAxis = Vector3.up;
  10. // Use this for initialization
  11. private void Start()
  12. {
  13. rotAxis.Normalize();
  14. }
  15. // Update is called once per frame
  16. private void Update()
  17. {
  18. transform.Rotate(rotAxis, degPerSec * Time.deltaTime);
  19. }
  20. }
  21. }