public Vector3 velocity ;

Description

障碍物沿着导航网格移动的速度。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public AI.NavMeshObstacle obs; public Transform player; public float moveSpeed; void Start() { obs = GetComponent<AI.NavMeshObstacle>(); } void Update() { Vector3 targetPoint = player.TransformPoint(Vector3.forward * 5.0F); Vector3 heading = player.position - transform.position.normalized; obs.velocity = heading * moveSpeed; } }