donmccurdy / aframe-inspector-plugin-recast

A-Frame Inspector plugin for creating navigation meshes.
MIT License
65 stars 14 forks source link

Can only produce very vague sloped navmesh #33

Open rossbishop opened 3 years ago

rossbishop commented 3 years ago

I've been trying to create a very large navmesh that will work with steeply raked stairs and my general findings with this tool are that it simply doesn't produce a mesh with enough detail to cover the stairsteps properly, so I end up with a very blocky bowl shape instead, which usually means that a "player" object in aframe constrained to navmesh isn't following the actual shape of the real geometry very well + gets stuck in all the weird ruts that the tool creates.

I've tried to create decimated meshes of the top surface of my walkable areas manually in Blender and export them (post Blender 2.7 game engine navmesh tool removal) but they seem to be completely ignored by the aframe-extras pathfinding library.

Is there anything special I need to do to create these meshes manually, are there specific geometric rules I need to follow regarding shape, number of triangles etc?

rossbishop commented 3 years ago

I'm assuming the reason the manual export of mesh from Blender doesn't work is because there's some special sauce baked into the gltf models the aframe plugin includes in the model related to navigation. Without that data, aframe-extras navigation has nothing to follow I'm guessing.

Some images to demonstrate the issues I'm having. Recast for desktop is following the stairstep, but the export format is some binary that I can't just bring into aframe and documentation about how to use Recast is borderline nonexistent.

Source mesh: image Aframe Recast plugin: image Recast Demo for desktop: image

donmccurdy commented 3 years ago

Reducing the cellSize might help here. Details in the mesh smaller than the cell size will not be reflected in the output.

I'm assuming ... there's some special sauce baked into the gltf models the aframe plugin includes in the model related to navigation.

There's nothing particularly special, but the triangles of the mesh do need to share vertices, i.e. to be connected. Disabling the "normals" export option in Blender might help with that. This library does try to do that automatically, too. Otherwise it's just a mesh, ideally with fairly consistent triangle sizes.

If you need more help with this issue you will probably need to share enough information for someone to reproduce the problem, such as the source scene. It's also possible that aframe-extras needs to update to the latest version of three-pathfinding or some other dependencies, see https://github.com/n5ro/aframe-extras/issues/359.

rossbishop commented 3 years ago

I've tried playing with the controls such as cell size and whatnot, what you see above in Recast desktop is using the same settings (those that are exposed to the user anyway). 0.1 for cell size, height etc. essentially the finest granularity the tool offers.

I'm also suffering from the CORS error that's reported in #25 (not a geo size issue, the iteration I'm working with at the moment is 214KB). Just trying to get the tool to build locally to see if that helps matters but running into errors there too.

I'm persistently playing with the geometry to try and improve things but I can provide the iteration I'm trying to use at present.

https://easyupload.io/skfbno

Turtleted21 commented 3 years ago

I think navmesh don't work with aframe 1.2, use aframe 1.1 I don't use plugin to create the navmesh, I build it manually in Blender for better optimization. Use glb format, verify normal orientation, player position must start over the polygons. navmesh work for me.

rossbishop commented 3 years ago

Here I tried a very simplified ramp - something looks clearly wrong with this tool. I'm not sure what, but there's no way that should be the result for such a simple model.

image

donmccurdy commented 3 years ago

@rossbishop output for the model you've provided looks as-expected when dropped into the example A-Frame setup provided by this repository (which, notably, runs the older A-Frame 0.8.2 version) —

Screen Shot 2021-05-17 at 5 14 38 PM

I don't really want to try to guess at different scene configurations and A-Frame versions trying to reproduce the issue; if you can provide a complete demo that reproduces the issue that might be possible to debug.

Your last screenshot has some odd artifacts at the corners but otherwise does not look unusual. A navmesh does not necessarily try to follow the curve of every step. Depending on the options configured, it may generate a ramp that allows a character to walk up the stairs smoothly. For stairs that are very large (as in the screenshot above) the steps will be considered non-traversible.