Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for variable agent sizes #39

Open
Elabajaba opened this issue Aug 10, 2023 · 2 comments
Open

Support for variable agent sizes #39

Elabajaba opened this issue Aug 10, 2023 · 2 comments

Comments

@Elabajaba
Copy link
Contributor

Elabajaba commented Aug 10, 2023

It's not uncommon to have units of different sizes, and you might have areas of the navmesh that are accessible to smaller units but not larger units.

Ideally there'd be some way to pass in the unit radius when searching for a path, and it'd return a valid path for a unit of that size.

In the below image, a small unit would take the leftmost passage, a medium unit could go up, and a large unit has to go right and go all the way around.
agent_size_12-1
(image from https://www.jdxdev.com/blog/2021/07/06/rts-pathfinding-2-dynamic-navmesh-with-constrained-delaunay-triangles/)

It might be possible to just compare the interval size against the unit radius, and reject intervals that are too small, but that might end up being too pessimistic (or I might be misremembering how polyanya works)?

@mockersf
Copy link
Member

mockersf commented Aug 11, 2023

That would work for polynya if we're sure that every vertex in the navmesh is on an obstacle. This is not a guarantee coming, from any navmesh made with any polygon, but I think it's true coming from a Constrained Delaunay Triangulation (if the constraints are the obstacles).

Also, this is a way to adapt the navmesh "online" to unit size. I think the other way is to "shrink" the navmesh depending on the unit size. It's a tradeoff between memory usage and pathfinding speed.

@mockersf
Copy link
Member

#74 adds agent radius support when generating a navmesh from a triangulation. it inflates obstacles using the radius, making sure agent never come closer than that to the obstacle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants