| 123456789101112131415161718192021222324252627282930313233343536373839 | 
							- using Core.Utility;
 
- using UnityEngine;
 
- public class DrawParabola : MonoBehaviour
 
- {
 
-     public Vector3 startPos = new Vector3(0, 0, 0);
 
-     public Vector3 targetPos = new Vector3(10, 5, 10);
 
-     public int segments = 100; // 抛物线段数
 
-     private LineRenderer lineRenderer;
 
-     private Parabola3DPath path;
 
-     [ContextMenu("dasdasd")]
 
-   public  void Start22()
 
-     {
 
-         // 初始化 LineRenderer
 
-         lineRenderer = gameObject.AddComponent<LineRenderer>();
 
-         lineRenderer.positionCount = segments + 1;
 
-         lineRenderer.useWorldSpace = true;
 
-         lineRenderer.startWidth = 0.1f;
 
-         lineRenderer.endWidth = 0.1f;
 
-         // 初始化 Parabola3DPath
 
-         path = new Parabola3DPath(startPos, targetPos);
 
-         // 绘制抛物线
 
-         DrawPath();
 
-     }
 
-     void DrawPath()
 
-     {
 
-         for (int i = 0; i <= segments; i++)
 
-         {
 
-             float t = i * (path.totalFlightTime / segments);
 
-             Vector3 position = path.GetPositionAtTime(t);
 
-             lineRenderer.SetPosition(i, position);
 
-         }
 
-     }
 
- }
 
 
  |