PolygonRotation.cs 738 B

123456789101112131415161718192021222324252627282930
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace PolygonArsenal
  4. {
  5. public class PolygonRotation : MonoBehaviour
  6. {
  7. [Header("Rotate axises by degrees per second")]
  8. public Vector3 rotateVector = Vector3.zero;
  9. public enum spaceEnum { Local, World };
  10. public spaceEnum rotateSpace;
  11. // Use this for initialization
  12. void Start()
  13. {
  14. }
  15. // Update is called once per frame
  16. void Update()
  17. {
  18. if (rotateSpace == spaceEnum.Local)
  19. transform.Rotate(rotateVector * Time.deltaTime);
  20. if (rotateSpace == spaceEnum.World)
  21. transform.Rotate(rotateVector * Time.deltaTime, Space.World);
  22. }
  23. }
  24. }