godot icon indicating copy to clipboard operation
godot copied to clipboard

Add NavigationAgent Path Debug Visualization

Open smix8 opened this issue 2 years ago • 1 comments
trafficstars

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.

agent_debug

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

agent_debug_ps

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.

smix8 avatar Jan 17 '23 08:01 smix8

I'll be testing & reviewing this within the next 16h

Scony avatar Jan 28 '23 22:01 Scony

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.

smix8 avatar Jan 31 '23 15:01 smix8

Thanks!

akien-mga avatar Feb 01 '23 07:02 akien-mga