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

can build mesh from edge lists #38

Merged
merged 21 commits into from
Aug 17, 2023
Merged

can build mesh from edge lists #38

merged 21 commits into from
Aug 17, 2023

Conversation

mockersf
Copy link
Member

@mockersf mockersf commented Aug 8, 2023

an easier api to create meshes just from a list of edges:

  • create a constrained Delaunay triangulation
  • add the list of outer edges as constrained edges
  • add each obstacle edges as constrained edges
  • get the list of faces; if the face center is not in the outer edge polygon, or is in an obstacle polygon, ignore it

@Elabajaba
Copy link
Contributor

Elabajaba commented Aug 10, 2023

I feel like this might be more useful if the CDT was persisted, and users could modify it to add/remove obstacles.

With that it'd be possible to add a module to bevy_pathmesh that would let users add/remove/modify colliders relatively easily (eg. like https://github.com/TheGrimsey/oxidized_navigation) and performantly, vs having to fully rebuild the triangulation every time a collider is added/moved/otherwise modified.

It'd be nice to eventually get something similar to https://www.jdxdev.com/blog/2021/07/06/rts-pathfinding-2-dynamic-navmesh-with-constrained-delaunay-triangles/

edit: Though of course, doing a triangulation also leaves some pathfinding performance on the table since polyanya can work with ngons.

@mockersf
Copy link
Member Author

Thanks for the link! Lots of interesting info

I'm hoping to make this API nicer to reuse/update, I'm trying to build an interactive demo but didn't have much time lately. Hopefully I should have some soon!

Going from triangles to polygons is possible, there are a few algorithms on how to merge them. My idea is to have pretty much three levels of navmesh:

  • a CDT representation for easy updates
  • a trimesh faster to generate but slower to path
  • a polygon mesh slower to generate but faster to path

"slow" and "fast" are very... nebulous for now. On the small example I added (and on my laptop), going from CDT to trimesh takes 140µs and finding a path on that trimesh 8µs

@mockersf mockersf added this pull request to the merge queue Aug 17, 2023
Merged via the queue into main with commit 135db8b Aug 17, 2023
8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants