So, I’ve been trying to implement a random Wander behaviour in my NPCs and after some thought I decided to use the ConstantPath, but the problem is, it only ever returns 1 node.
Graph type: Recast
A* version: 4.2.15
Unity version: 2019.4.8f1 LTS
This is my code:
currently: maxDistance is equal to 5, casted as int because it is a float
so, multiplied by 1000 it should return all nodes within 5 walkable meters from my current node, as far as I understood the usage of ConstantPath
However, upon receiving the callback, I get this:
constantPath.allNodes.Count == 1
When there are clearly nodes within 5 meters from my character:
(Red circle is the character, white dots are random points on constantPath.allNodes, white square is the selected random node it is wandering towards.)
The path is ignoring all other nodes, unless the distance is set to a higher number (10 meters for example, and even so, it only selects at most 2 nodes, disregarding closer nodes).