godot
godot copied to clipboard
Add NavigationAgent Path Debug Visualization
Adds path debug visuals for NavigationAgent2D, NavigationAgent3D and NavigationServer.
The NavigationAgent build-in path debug visuals are toggleable per agent in the inspector with debug_enabled property. Custom properties like path color or rasterized point size can be also used per agent instead of the global values when debug_use_custom is enabled.

As with other navigation debugs the global values can be controlled in the ProjectSettings from ProjectSettings->Debug->Shapes.

While 2D always had an easy time just adding the navigation path points array to a Line2D node for display such an option did not exist for 3D and creating a debug mesh for paths was actually a ton of work and troublesome for beginners. Even for 2D using a node for display was troublesome as it messed with the SceneTree and child functions.
The debug visuals now use the RenderingServer directly, so no unexpected debug Nodes that appear in the SceneTree or RemoteSceneTree and mess up child functions and also no Node overhead. The rendering is updated only once when the agent path or properties change and not every frame to keep runtime performance cost low.
I'll be testing & reviewing this within the next 16h
I removed the reliance on the Editor->Debug->Visible Nvaigation enabled and the NavigationServer debug_enabled. I still kept the reliance on debug_navigation_enable_agent_paths but this is enabled by default. Users need to go to the ProjectSettings and intentionally disable this. I guess if someone intentionally disables all agent paths it is expect that they do not appear so requires no further documentation why they don't appear anymore.
Thanks!