脚本方程依据:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class Bezier : System.Object
{
//三次贝塞尔曲线,4个点
public Vector3 p0;
public Vector3 p1;
public Vector3 p2;
public Vector3 p3;
public float ti = 0f;
//记录的上次贝塞尔曲线的4个点,如果没有改变就不刷新曲线
private Vector3 b0 = Vector3.zero;
private Vector3 b1 = Vector3.zero;
private Vector3 b2 = Vector3.zero;
private Vector3 b3 = Vector3.zero;
//贝塞尔曲线计算方程参数
//方程:B(t) = (1-t)3P0 + 3t(1 - t)2P1 + 3t2P2(1 - t) + P3t3 t(0~1)
private float Ax;
private float Ay;
private float Az;
private float Bx;
private float By;
private float Bz;
private float Cx;
private float Cy;
private float Cz;
public Bezier(Vector3 v0, Vector3 v1, V