TheGrimsey / oxidized_navigation

A runtime Nav-Mesh generation plugin for Bevy Engine in Rust.
Apache License 2.0
169 stars 12 forks source link

Navmesh is generated inconsistently at the edges of tiles #2

Closed janhohenheim closed 1 year ago

janhohenheim commented 1 year ago

See minimal example of bug at https://github.com/janhohenheim/navigation-mcve

Inconsistent generation: image image

TheGrimsey commented 1 year ago

In 0.2 this is mitigated when walkable_radius > 0 (the tile is temporarily extended during generation to correctly handle radius outside of a single tile).

Not closing this yet though. I have a solution for when walkable_radius == 0 which I will get around to.

janhohenheim commented 1 year ago

Nice! As soon as you have the fix, I'll try incorporating it again into foxtrot.

janhohenheim commented 1 year ago

Update: I already added it to Foxtrot on the main branch. It works soooo much better than before, thanks! It still sometimes tries to find a path directly through a building and other times takes a detour even though the target is within line of sight. I added a little condition that if line of sight is established, pathfinding is halted and the NPC just goes directly in my direction. With that change, the shortcomings are barely noticeable, so I'm already quite happy!. Do you have any advice for params to further tweak? I am still using the same params as your example.

janhohenheim commented 1 year ago

After playing a bit with the settings, I found that the reason behind the pathfinding taking long ways is that I set the walkable radius too high, thus making it impossible to take the short paths which were narrower. So ignore that part of my comment :)

TheGrimsey commented 1 year ago

I've been forgetting to respond to this. Sorry for that.

I'm gonna pull Foxtrot and see if I can figure it out. Looks to be an excellent example of a slightly more complex scene. Might be I've made an error in the voxelization somewhere.

janhohenheim commented 1 year ago

No problem 😄 I've changed the navmesh generation settings a bit to minimize the issues, but sometimes a path through a wall is still generated. It's hard to reproduce though. To show the navmesh and pathfinding ingame press Q to free the mouse, click on "Open window" on the top of the screen, select "Foxtrot Dev" and then enable "Navmeshes".: image

TheGrimsey commented 1 year ago

Sorry for being so late getting back to this.

I don't know if it's something you've changed or something that happened in relation to 0.10 but pulling the latest version of Foxtrot, and having a wander around, I couldn't see any points where it looks like the Nav-mesh is incorrectly connecting.

This was on the default old_town map.

I see some need for improvements on my end though, I'm not a fan of how the generation creates inaccessible islands inside buildings. I would like to add a 'negative' volume to remove those.

nightactive-git commented 1 year ago

Hi, I'm not sure if my topic is related to this one, but I also noticed a problem with navmesh generation if an object intersect two tiles. I have a plane and place Blocks on it. Sometimes only the half of the block is regarded on the plane. Here is a screenshot:

problem_with_navmesh_genration
TheGrimsey commented 1 year ago

I believe this should've been fixed in 0.5.2 released a few days ago. Would love to hear if you still see this issue, otherwise, I am closing this for now.

janhohenheim commented 1 year ago

Cool! I'll check when I port Foxtrot to 0.11 :)