fxvRotate.cs 834 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace FXV.FogDemo
  5. {
  6. public class fxvRotate : MonoBehaviour
  7. {
  8. public bool randomRotation = false;
  9. public Vector3 rotationSpeed = Vector3.up;
  10. private Vector3 currentRotation;
  11. void Start()
  12. {
  13. currentRotation = transform.rotation.eulerAngles;
  14. if (randomRotation)
  15. {
  16. rotationSpeed = new Vector3(Random.Range(-rotationSpeed.x, rotationSpeed.x), Random.Range(-rotationSpeed.y, rotationSpeed.y), Random.Range(-rotationSpeed.z, rotationSpeed.z));
  17. }
  18. }
  19. void Update()
  20. {
  21. currentRotation += rotationSpeed * Time.deltaTime;
  22. transform.rotation = Quaternion.Euler(currentRotation);
  23. }
  24. }
  25. }