PDA

View Full Version : no LOS to end path node?


jdoran
01-14-2014, 08:56 PM
I'm having some pathing issues with a new NPC, and am puzzled by what I am seeing. I sure hope someone familiar with pathing can set me straight.

PathManager::FindRoute(Vertex,Vertex) checks for LOS to the starting path node. OK, this succeeds and makes sense.

But then it checks for LOS on the end path node, and fails.


if(ClosestPathNodeToEnd < 0) {
_log(PATHING__DEBUG, "No LOS to any end Path Node within range.");
return noderoute;
}


At this point, noderoute is an empty list.

I was kind of hoping that pathfinding would allow me to find a route to a distant node out of sight. I could have swore that it did so. Am I
misunderstanding this?

The particular case in question is a large outdoor zone (moors) with the NPC starting in a low area. The target vertex is out of LOS. Most of the zone
is LOS.

The reason I am looking into this particular code is that my NPC is moving
forward and then warping back to its original position. I believe that the
server is sending it underground, and the client moves it back. In any
event CalculateNewPosition2 is called with the destination vertex
rather than a path node. (Since no route was found, since the destination
is not in LOS).

If I had LOS and there were no hazards, I would not need pathfinding. :???:

jdoran
01-14-2014, 09:08 PM
A quick update. Sometimes just writing the question out helps.
I believe I misunderstood the message, and it was saying that there was no LOS from the end vertex to any path node. On further inspection, the Z coord of the destination vertex had been set to -999999.

This was due to FindBestZ not finding a point above ground. FindClosestZ did the trick. Z-fixup was needed to keep the NPC from bouncing around when it neared the waypoint. I used #loc to get the coords of the waypoint, and that might not agree exactly with the terrain.