GetNearest not considering Y Axis

Im having two floors with two recast graph, when i try to find the nearest position on a particular recast graph its not considering the distance in y axis and returns the point which is on the second floor, but it should return nearest point in the first floor thats where my query position is.


Which version of the package are you using, and have you specified in the recast graph settings that the faster XZ distance mode should be used (or specified this in the NNConstraint)?

my version is 4.2.18, in nnconstraint its just default i didnt change anything.
Screenshot 2023-09-18 at 8.01.32 PM

That’s odd. Do you think you can show me a screenshot of this, including the query point, result point and graph?

this is my setup and other things.

Are you sure the yellow navmesh below the agent isn’t actually closer purely from a geometric standpoint? It looks like it could be the case.

Actually its closer if we compare the distance, but thats not the expected result rite?

GetNearest will always return the geometrically closest one. It does not take graph connectivity into account.

If you want the closest according to the graph, you may be interested in MultiTargetPath - A* Pathfinding Project or XPath - A* Pathfinding Project

thank you , will look into that.

i have checked the above links but this wont solve my problem, my logic is i have a start position and for the end position i need to find the nearest point so that it will be the end position, then only i can construct a path, any idea how to solve this?