EnvMapAnimator.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using UnityEngine;
  2. using System.Collections;
  3. using TMPro;
  4. public class EnvMapAnimator : MonoBehaviour {
  5. //private Vector3 TranslationSpeeds;
  6. public Vector3 RotationSpeeds;
  7. private TMP_Text m_textMeshPro;
  8. private Material m_material;
  9. void Awake()
  10. {
  11. //Debug.Log("Awake() on Script called.");
  12. m_textMeshPro = GetComponent<TMP_Text>();
  13. m_material = m_textMeshPro.fontSharedMaterial;
  14. }
  15. // Use this for initialization
  16. IEnumerator Start ()
  17. {
  18. Matrix4x4 matrix = new Matrix4x4();
  19. while (true)
  20. {
  21. //matrix.SetTRS(new Vector3 (Time.time * TranslationSpeeds.x, Time.time * TranslationSpeeds.y, Time.time * TranslationSpeeds.z), Quaternion.Euler(Time.time * RotationSpeeds.x, Time.time * RotationSpeeds.y , Time.time * RotationSpeeds.z), Vector3.one);
  22. matrix.SetTRS(Vector3.zero, Quaternion.Euler(Time.time * RotationSpeeds.x, Time.time * RotationSpeeds.y , Time.time * RotationSpeeds.z), Vector3.one);
  23. m_material.SetMatrix("_EnvMatrix", matrix);
  24. yield return null;
  25. }
  26. }
  27. }