RadialBarController.cs 640 B

12345678910111213141516
  1. using UnityEngine;
  2. using System.Collections;
  3. using VertexAnimationTools_30;
  4. namespace VertexAnimationTools_Examples {
  5. [ExecuteInEditMode]
  6. public class RadialBarController : MonoBehaviour {
  7. public PointCachePlayer pcplayer;
  8. void Update() {
  9. Vector3 lp = pcplayer.transform.worldToLocalMatrix.MultiplyPoint3x4(transform.position);
  10. pcplayer.Clip0NormalizedTime = Mathf.Atan2(-lp.x, -lp.y) * Mathf.Rad2Deg / 360f + 0.5f;
  11. Debug.DrawLine(pcplayer.transform.position, pcplayer.transform.localToWorldMatrix.MultiplyPoint3x4(new Vector3(lp.x, lp.y, 0) ), Color.red);
  12. }
  13. }
  14. }