1、先创建三个球
2、创建脚本
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DrawBesizerLine : MonoBehaviour
{
public GameObject[] basePoint; //基础点
public int baseCount = 500; //两个基础点之间的取点数量 值越大曲线就越平滑 但同时计算量也也越大
public static List<Vector3> lsPoint = new List<Vector3>();
public Transform sphere; //目标小球
float speed = 40.0f; //运动速度
float length = 0; //小球当前的运动轨迹长度
LineRenderer lineRender;
void Start()
{
lineRender = gameObject.GetComponent<LineRenderer>();
InitPoint();
}
void Update()
{
length += Time.d