Setting NavigationMesh and NavigationAgent properly

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BigBadWouf

Hello !

I play with the new navigation system of godot 3.5 beta and having trouble with agent behavior.
I have a scene with a Navigation node and NavigationMeshInstance as child. All settings by default, except agent/radius. At runtime, i add some children (StaticBody containing MeshInstance and CollisionShape) in NavigationMeshInstanceand call $NavigationMeshInstance.bake_navigation_mesh(). I add a character (a RigidBody setting as character) and it can navigate.
Yep, but the children of NavigationMeshInstance is multiple square (PlaneMesh) of 1x1, disposed like path (See screenshot). When the agent get path by using $NavigationAgent.set_target_location(target), the point is closet of intersection (In white on the scrrenshot) and the agent don’t follow this point and go away of navigation area (in red on the screenshot). What i want to do is make agent to stay in the navigation mesh, without cut corner.

I tried to play with differents options, without result. And… I discover the “Target desired distance” on the NavigationAgent. If i set it small, the agent stick more the path. In fact, all points in the path is a target until it reached. But… With a lower value in this option, my agent never reach the final target, cause it is the origin of a StaticMesh (a simple cube in this experiment) and the event associed to reached target never firing… So, i need to choose between the respect of navigation area or the possibility to reach the target. If i choose the respect, i need to create a hackish code to detect the target proximity. Instead of respect, if i choose the reaching target, the behavior of the agent become a problem.
In this example, i have a black plane for the ground. What happens if i remove it ?
I think agent need more option to adjust behavior for covering various need. In the actual state, a lot of situation van be complicated with Navigation.

So, my opinion aside, maybe i missed something or misunderstood some options or concept.
The fact is, i dont know how to make my agent stay indise the navmesh and can still use the reached signal.
I stay open to any suggestions or explainations.

(Sorry for bad english :))