#Navigation Agent Flying Enemy Help
7 messages · Page 1 of 1 (latest)
Use one or more Area3D with Collisionshape set to Sphere. Then move that Area3D around and check for collissions with the environment to figure out where you can go. Sphere is the fastest collision shape so it allows you to do the most checks without losing performance.
You can also do a regular check with NavigationAgent and compare with a direct path to the target. If they are close you probably do not need to fly over anything.
You could raycast/shapecast ( maybe slightly in front of your enemy ) to get the (projected) distance to the ground and then act accordingly
Ok, think I've got an idea...so no built in way to handle, and will need to do a mix of a manual system with navigation
Just bake a navigation mesh with increased max_slope to 90° and the max_climp to something high like 2m. This way your navigation mesh will go over all ground objects. The right setting values will depend on your cell size and height and your source geometry but in general with those parameters you can cover this "flying over" things. What you can not do with this is "flying under" things. For that you would either need to use multiple maps or do a voxel based pathfinding.
Like for basic flying units you really do not need a detailed navigation mesh, you can go with a cell size of 1-2+ and for the cell height us the height of your largest building. Use double that value for the max_climb. That will yield a navigation mesh that goes roughly half sphere around ground objects.
I was playing with that earlier and it caused some weird geometry, ill play around again with around those values