Fix missing NavigationAgent property updates in constructor

Fixes missing NavigationAgent property updates in constructor.
This commit is contained in:
smix8 2023-10-23 04:27:49 +02:00
parent f71f4b80e3
commit 9640179f93
2 changed files with 15 additions and 11 deletions

View File

@ -294,6 +294,13 @@ NavigationAgent2D::NavigationAgent2D() {
NavigationServer2D::get_singleton()->agent_set_time_horizon_obstacles(agent, time_horizon_obstacles); NavigationServer2D::get_singleton()->agent_set_time_horizon_obstacles(agent, time_horizon_obstacles);
NavigationServer2D::get_singleton()->agent_set_radius(agent, radius); NavigationServer2D::get_singleton()->agent_set_radius(agent, radius);
NavigationServer2D::get_singleton()->agent_set_max_speed(agent, max_speed); NavigationServer2D::get_singleton()->agent_set_max_speed(agent, max_speed);
NavigationServer2D::get_singleton()->agent_set_avoidance_layers(agent, avoidance_layers);
NavigationServer2D::get_singleton()->agent_set_avoidance_mask(agent, avoidance_mask);
NavigationServer2D::get_singleton()->agent_set_avoidance_priority(agent, avoidance_priority);
NavigationServer2D::get_singleton()->agent_set_avoidance_enabled(agent, avoidance_enabled);
if (avoidance_enabled) {
NavigationServer2D::get_singleton()->agent_set_avoidance_callback(agent, callable_mp(this, &NavigationAgent2D::_avoidance_done));
}
// Preallocate query and result objects to improve performance. // Preallocate query and result objects to improve performance.
navigation_query = Ref<NavigationPathQueryParameters2D>(); navigation_query = Ref<NavigationPathQueryParameters2D>();
@ -302,11 +309,6 @@ NavigationAgent2D::NavigationAgent2D() {
navigation_result = Ref<NavigationPathQueryResult2D>(); navigation_result = Ref<NavigationPathQueryResult2D>();
navigation_result.instantiate(); navigation_result.instantiate();
set_avoidance_layers(avoidance_layers);
set_avoidance_mask(avoidance_mask);
set_avoidance_priority(avoidance_priority);
set_avoidance_enabled(avoidance_enabled);
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
NavigationServer2D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationAgent2D::_navigation_debug_changed)); NavigationServer2D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationAgent2D::_navigation_debug_changed));
#endif // DEBUG_ENABLED #endif // DEBUG_ENABLED

View File

@ -329,6 +329,14 @@ NavigationAgent3D::NavigationAgent3D() {
NavigationServer3D::get_singleton()->agent_set_radius(agent, radius); NavigationServer3D::get_singleton()->agent_set_radius(agent, radius);
NavigationServer3D::get_singleton()->agent_set_height(agent, height); NavigationServer3D::get_singleton()->agent_set_height(agent, height);
NavigationServer3D::get_singleton()->agent_set_max_speed(agent, max_speed); NavigationServer3D::get_singleton()->agent_set_max_speed(agent, max_speed);
NavigationServer3D::get_singleton()->agent_set_avoidance_layers(agent, avoidance_layers);
NavigationServer3D::get_singleton()->agent_set_avoidance_mask(agent, avoidance_mask);
NavigationServer3D::get_singleton()->agent_set_avoidance_priority(agent, avoidance_priority);
NavigationServer3D::get_singleton()->agent_set_use_3d_avoidance(agent, use_3d_avoidance);
NavigationServer3D::get_singleton()->agent_set_avoidance_enabled(agent, avoidance_enabled);
if (avoidance_enabled) {
NavigationServer3D::get_singleton()->agent_set_avoidance_callback(agent, callable_mp(this, &NavigationAgent3D::_avoidance_done));
}
// Preallocate query and result objects to improve performance. // Preallocate query and result objects to improve performance.
navigation_query = Ref<NavigationPathQueryParameters3D>(); navigation_query = Ref<NavigationPathQueryParameters3D>();
@ -337,12 +345,6 @@ NavigationAgent3D::NavigationAgent3D() {
navigation_result = Ref<NavigationPathQueryResult3D>(); navigation_result = Ref<NavigationPathQueryResult3D>();
navigation_result.instantiate(); navigation_result.instantiate();
set_avoidance_layers(avoidance_layers);
set_avoidance_mask(avoidance_mask);
set_avoidance_priority(avoidance_priority);
set_use_3d_avoidance(use_3d_avoidance);
set_avoidance_enabled(avoidance_enabled);
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
NavigationServer3D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationAgent3D::_navigation_debug_changed)); NavigationServer3D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationAgent3D::_navigation_debug_changed));
#endif // DEBUG_ENABLED #endif // DEBUG_ENABLED