using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FollowPathMove : MonoBehaviour
{
public Transform[] wayPointArray;
[SerializeField] private Transform PathA;//路径点的父物体
[SerializeField]private Transform playerObj;//移动的物体
private int index;
private Vector3 _currentDirection;//当前角色的前进方向
void Start()
{
if(playerObj==null)
{
Debug.LogError("请将移动的角 色放入参数栏");
}
//print(PathA.childCount);//获取子物体的数量
//开辟空间
wayPointArray = new Transform[PathA.childCount];
for(int i=0;i<wayPointArray.Length;i++)
{
wayPointArray[i]=PathA.Get
unity按路径移动,向导
于 2024-04-09 21:20:12 首次发布