Gap on tile border?


#1

image


#2

Hi

This is actually not an issue for pathfinding. The algorithm can sometimes generate different number of vertices along tile borders, however special care is taken along tile borders so that the nodes are still properly connected. It will look a bit weird in the scene view, but pathfinding-wise it will be ok.


#3

It seems not to be the case as you said, unfortunately. :frowning:

My character cannot walk across the gap.
If I check Nearest node queries in XZ space, it can walk but it will have incorrect behavior for multi floors.


#4

Hi

Hm… which movement script are you using?


#5

I wrote it myself, but basically I use the API.

...
                if (isXZ)
                {
                    newPos = curNode.ClosestPointOnNodeXZ(endPos);
                    newPos.y = endPos.y;
                }
                else
                {
                    newPos = curNode.ClosestPointOnNode(endPos);
                }
...
        NNConstraint contraint;
        if (isXZ)
        {
            contraint = NavmeshConstant.CONSTRAINT_XZ;
        }
        else
        {
            contraint = NavmeshConstant.CONSTRAINT_NONE;
        }
        NNInfo info = AstarPath.active.GetNearest(pos, contraint);
...