AILerp: updatePosition, updateRotation

I’m looking to write my own movement script. Reading AILerp, I’m stumped by what updatePosition and updateRotation actually do. When I examine their references, I don’t see any place where they’re ever set to false. When is a situation where I’d want to set it from script? What’s their purpose?

If PersonA is trying to catch PersonB what’s the best position for PersonA to sample from for a heuristic “go to where PersonB is trying to go instead of where they are” heuristic? “destination”?

Hi

They are never set to false because they are intended to be controlled by another script. They are useful if you want to decouple the agent’s movement from the movement of the GameObject itself (see also https://arongranberg.com/astar/docs/aibase.html#updatePosition). So the agent’s position is not necessarily at the pivot point of the GameObject.

You could do a lookahead along the path.
This does require accessing a protected variable in AILerp though. So if you subclass it you can do this.

Vector3 Lookahead (float distance) {
    var originalDistance = interpolator.remainingDistance;
    interpolator.remainingDistance = originalDistance - distance;
    Vector3 result = interpolator.position;
    interpolator.remainingDistance = originalDistance;
    return result;
}

This will return a point on the path that the agent will soon reach.