Closed FrameMuse closed 4 months ago
Recast (a navmesh generator) has an option built in, I think it's called "agent size". The idea is to leave some padding around the navmesh, like what you see here:
The pathfinding library itself (this one, at least ...) does not consider things like agent size or height, so that would need to be built into the navmesh.
@donmccurdy But what if I have many different unit types that have different sizes? I don't think a good way is to create nav mashes for all unit types. I would like it to be a property that can be changed easily in code and dynamically.
I could certainly be wrong, but I believe this is generally how navmeshes work. Consider larger margins – if you have larger characters that cannot fit through narrower spaces, you would generate different navmeshes for them, and their paths may be very different from smaller characters' paths. Navmeshes can be regenerated dynamically, too. The tradeoff is so that pathfinding (which might run as often as every frame) can be as cheap as possible.
I've been researching how to add a safe-margin to my units, I could find much information since it's all related to Unity, which has its own built-in scripts.
I also found something about altering the heuristic, but I don't understand how. There is an advice to "see" for closest point of "wall" or "edge", but I don't understand how.
So could you help me with that, I'm not sure how to add this, I think there is no way with current API to do that.
I feel like this is worth adding to the library eventually.