个体AI角色的操控行为de实现
2.4 Pursuit 追逐
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*追逐
* 类似于靠近行为,但目标是移动的,要实现的是可以预测目标未来的位置
* 使用简单的预测器,计算目标在未来时间T的目标位置,关键是确定预测间隔T
*/
public class SteeringForPursuit : Steering {
public GameObject target;
private Vector3 desiredVelocity;
private Vehicle m_vehicle;
private float maxSpeed;
// Use this for initialization
void Start () {
m_vehicle = GetComponent<Vehicle>();
maxSpeed = m_vehicle.maxSpeed;