-
Notifications
You must be signed in to change notification settings - Fork 317
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
Fix navmesh generation #1246
Comments
@luboslenco What is the current plan to get navmesh generation back? I ask this because maybe I can help with this.. |
@N8n5h here is an overview on current state:
Quick way to fix navmesh visualization could be to write a small haxe/js script calling into Recast when Generate Navmesh button gets pressed. Then the generated navmesh can be loaded and displayed into Blender viewport. Navmesh functionality is overall very rough, lots of work hidden there. |
Hi @luboslenco, so Generate Mesh is only for visualization and NavMesh is built every single time at runtime? I was playing with some of this recently and got a full red screen on player after adding Navigation, I just need to clarify a little bit to myself how it works, thanks! |
Yes, I was trying to find a way to communicate from python to cpp/haxe/js but couldn't find any example that doesn't require extra libraries, any example of that in Armory so I can look how this calling between languages works? |
@zevarito yeah, it's for visualization but it also adds a @N8n5h maybe this helps although it's not a direct call between languages - an example on how Armory executes js minifier using node: https://github.com/armory3d/armory/blob/master/blender/arm/make.py#L533. So the exchange might look something like: python writes .obj file -> js takes .obj file and generates navmesh cache -> python loads cache and displays it in viewport. |
Hi @luboslenco I noticed that when the mesh is exported in https://github.com/armory3d/armory/blob/master/blender/arm/exporter.py#L2601 |
Not sure if there is a way to configure that in recast, but I guess it assumes Y-up by default, hence the axis swap. |
@luboslenco I used the three js files from that repo to keep compatibility with the solution. I had to create a file that has all the content from all the scripts used because I couldn't find a way to simply "include" the content of those scripts in node js in a quick way that is not import nor require. The version provided of three js min in the repo doesn't work in node, so I had to use a newer one and the functionality that the solution uses is not present in newer versions from what I read, so I had to comment some warnings that complains about using deprecated functions. Maybe the solution could be updated to newer version of three js or ported to pure python to get rid of the threejs dependency but for now it works and results are quick enough in my tests so far. https://github.com/N8n5h/armory_tools/tree/patch-1 If the solution is okay I can create the PRs |
Update: doing more test I found that the solution works best when there is no elevation in the geometry: compared to b2.79: So I'm currently seeking for another solution to generate a mesh that works with elevations. I was looking at the source of b2.79 to see how it was done, and it uses information like boundbox or cells that can't be obtained in javascript from what I understand. So I'm currently looking to maybe expand the bindings so that info can be obtained if possible to port the solution from b2.79. If anyone knows another way please let me know. |
Merged now, thanks again! |
Firstly I guess in the last version of armory, the navmesh would show up as an actual object in the outliner with each poly in various colors, when you clicked the generate button. When you do it now, it appears as a trait under the plane i'm using for a ground (I assume it adds the navmesh to whatever object you have selected). You can't see it however as it's not an actual mesh object apparently.
In my blend file here, you'll also notice if you run it you can click anywhere on the plane, but the player box, only moves within a small area in the center, and then also goes through a couple of the obstacles there. Keep in mind that the "obstacles" were just extruded faces from the plane that was subdivided.
It's possible that I did something wrong because I'm still somewhat new to armory, however, someone suggested I submit this as a possible issue, just in case it's a bug.
My blend file is below.
AdventureGameTest_00001.zip
The text was updated successfully, but these errors were encountered: