-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Expose navmesh bake function to scripting #22767
Comments
This comment has been minimized.
This comment has been minimized.
I was about to suggest the same. Good that it already exists! If we could just give any mesh at runtime to a function, and receive a navmesh fitting that mesh as a result, things would look brighter. |
This issue is more than a year old but is not marked for any upcoming release version nor was it closed. Is there anything I am missing or did this just go unnoticed? |
The PR referenced above sounds like it would solve this. |
@ScyDev As I understand this it is only for gridmaps and neither at runtime? I made a quick hacky test yesterday, which creates a navmesh from a CSG plane with holes in it (subtracted CSG cubes) at runtime (shown in image). But this is still would not replace the "Bake NavMesh" function needed for runtime. The usecase is e.g. having a plane ground with baked navmesh, then the user places a rock onto the ground and the navmesh needs an update due to the new obstacle... |
@FrischerHering If you succeeded in updating a NavMesh at runtime (in 3D space or only on a plane?) I'd like very much to see how you did it :) Back when I commented on this issue, I couldn't do it and couldn't find a solution online, only people with the same problem, as in this issue. Being able to bake the NavMesh from script at runtime would seem to be an elegant solution, since all the necessary code already exists. And yes, that is exactly the use case that I have, new or dynamic obstacles that need to be respected in pathfinding. |
@ScyDev Important to note that it is a solution, but not a good solution! I basically used CSG meshes to form what the navmesh should look like. Then, using The problem here is, that the navmesh is overcomplicated (many and mostly unnecessary edges). Despite that fact, navmeshes in Godot (at least the 3d ones) are entirely unusable, because pathfinding is simply broken. I could post lots of calculated paths, that are simply wrong. E.g. instead of a straight line the generated path is a 6+ waypoints curve... I concluded, that even if this is a dynamic navmesh solution, I would rather stick to A* and try to workaround navmeshes completely... As some side facts, the mesh in the image above is a CSG plane with around 10 CSG cubes subtracting and creating the holes. The navmesh creation from CSG took 2ms and pathfinding is 0.2ms on average. |
@FrischerHering Can't comment on that as I don't really understand it that well. I can say that on manually arranged geometry and manually baked NavMesh it seemed to work well for me. Just had no way to update it at runtime. |
@ScyDev I think that for flat grounds navmeshes work pretty well, as they do in 2D. As already mentioned, my method of creating navmeshes in runtime is both overcomplicated and faulty. Exposing the baking tool to runtime and script still sounds like an easy adjustment for the engine. To add to the feature proposal, it should be up to the developer on how to deal with the time the baking takes. I.e. the engine should not try to run its own baking thread or anything like that. |
I will be attempting to expose the function. |
4.0 already allows in-game navmesh baking. I guess this issue can be closed now? |
I'd also say so. |
Closing, as this was implemented by #34776. |
@dodafish Would you mind explaining how you got your CSGPlane's mesh into the navmesh? The docs are all empty so I'm not sure how to set/replace the navmesh of a NavMeshInstance. What do I do with the mesh: This is all I could come up with:
But no luck with that... Thanks for any (more) insight you can provide. |
Godot version:
3.1. alpha 1
OS/device including version:
Win 7 x64
Issue description:
Please expose navmesh baking to scripting. It would be immensely useful for procedural maps.
Steps to reproduce:
N/A
Minimal reproduction project:
The text was updated successfully, but these errors were encountered: