mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Add NavigationAgent Path Debug Visualization
Adds path debug visuals for NavigationAgent2D, NavigationAgent3D and NavigationServer.
This commit is contained in:
@@ -207,6 +207,30 @@ void NavigationServer2D::set_debug_navigation_enable_edge_connections(const bool
|
||||
bool NavigationServer2D::get_debug_navigation_enable_edge_connections() const {
|
||||
return NavigationServer3D::get_singleton()->get_debug_navigation_enable_edge_connections();
|
||||
}
|
||||
|
||||
void NavigationServer2D::set_debug_navigation_agent_path_color(const Color &p_color) {
|
||||
NavigationServer3D::get_singleton()->set_debug_navigation_agent_path_color(p_color);
|
||||
}
|
||||
|
||||
Color NavigationServer2D::get_debug_navigation_agent_path_color() const {
|
||||
return NavigationServer3D::get_singleton()->get_debug_navigation_agent_path_color();
|
||||
}
|
||||
|
||||
void NavigationServer2D::set_debug_navigation_enable_agent_paths(const bool p_value) {
|
||||
NavigationServer3D::get_singleton()->set_debug_navigation_enable_agent_paths(p_value);
|
||||
}
|
||||
|
||||
bool NavigationServer2D::get_debug_navigation_enable_agent_paths() const {
|
||||
return NavigationServer3D::get_singleton()->get_debug_navigation_enable_agent_paths();
|
||||
}
|
||||
|
||||
void NavigationServer2D::set_debug_navigation_agent_path_point_size(float p_point_size) {
|
||||
NavigationServer3D::get_singleton()->set_debug_navigation_agent_path_point_size(p_point_size);
|
||||
}
|
||||
|
||||
float NavigationServer2D::get_debug_navigation_agent_path_point_size() const {
|
||||
return NavigationServer3D::get_singleton()->get_debug_navigation_agent_path_point_size();
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
void NavigationServer2D::_bind_methods() {
|
||||
@@ -286,14 +310,26 @@ void NavigationServer2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("free_rid", "rid"), &NavigationServer2D::free);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("navigation_debug_changed"));
|
||||
}
|
||||
|
||||
NavigationServer2D::NavigationServer2D() {
|
||||
singleton = this;
|
||||
ERR_FAIL_COND_MSG(!NavigationServer3D::get_singleton(), "The Navigation3D singleton should be initialized before the 2D one.");
|
||||
NavigationServer3D::get_singleton()->connect("map_changed", callable_mp(this, &NavigationServer2D::_emit_map_changed));
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
NavigationServer3D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationServer2D::_emit_navigation_debug_changed_signal));
|
||||
#endif // DEBUG_ENABLED
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
void NavigationServer2D::_emit_navigation_debug_changed_signal() {
|
||||
emit_signal(SNAME("navigation_debug_changed"));
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
NavigationServer2D::~NavigationServer2D() {
|
||||
singleton = nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user