12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- namespace Core.Utility
- {
- public class BesselPathMono : MonoBehaviour
- {
- public Transform[] Transforms;
- public BesselPath BesselPath;
- private void OnDrawGizmos()
- {
- if (BesselPath == null)
- {
- BesselPath = new BesselPath();
- }
- if (Transforms == null || Transforms.Length < 2)
- {
- return;
- }
- List<Vector3> pos = new List<Vector3>();
- for (int i = 0; i < Transforms.Length; i++)
- {
- pos.Add(Transforms[i].position);
- }
- BesselPath.SetPos(pos);
- float bl = 1.0f / 300;
- for (float i = 0; i < 300 - 1; i++)
- {
- Vector3 pos1 = BesselPath.GetValue(i * bl);
- Vector3 pos2 = BesselPath.GetValue((i + 1) * bl);
- Debug.DrawLine(pos1, pos2, Color.red);
- }
- }
- }
- }
|