AI Path following broken in 1.8.0?

Is AI path following broken in 1.8.0, or am I missing something?

I use AIBehaviors.addToPath() to add waypoints for an AI node (in reverse, as the manual says), and the node is indeed “kind of” passing the waypoints, although it already turns for the next waypoint way before it has arrived at the previous one (Fluctuates wildly, but is consistent for the same distance… sometimes about 60% of the way, sometimes 30%, sometimes 50%…).

Only the final path is reached, even though this is also only almost, as it’s not perfectly standing in the center of the target, but stops a few units before.

What am I doing wrong?

Figured out what’s happening after consulting the source code™:

The path walker has a hardcoded distance threshold of 5 units for each target, so walkers will always cut corners 5 units in front of their goals (except for the last node, which the walker regards as reached 1 unit too early :wink:. If the playing field was larger, this would cause less of an issue, but since my units have a unit length of 0.25, this is a pretty grave violation.

I solved the problem by hacking around: each target point is extruded 5 units along the direction vector, except the last point which only needs to be extended by 1 unit.

Here’s my code that produces the correct, expected results

        ai = agent.ai_behaviors
        pts = []
        lastpos = self.node.getPos()
        for i,wp in enumerate(self.wp):
            pos = Vec3(wp.node.getPos())
            mpos = pos
            if lastpos:
                d = pos - lastpos
                if i < (len(self.wp)-1):
                    mpos = mpos + d*5
                    mpos = mpos + d
            lastpos = pos
        for pos in reversed(pts):