Fix NavObjects map assignments

Fixes NavObject map assignments.
This commit is contained in:
smix8
2023-06-25 05:28:21 +02:00
parent 3710f06929
commit 4ae5dcca45
4 changed files with 48 additions and 75 deletions

View File

@@ -90,8 +90,23 @@ void NavAgent::_update_rvo_agent_properties() {
}
void NavAgent::set_map(NavMap *p_map) {
if (map == p_map) {
return;
}
if (map) {
map->remove_agent(this);
}
map = p_map;
agent_dirty = true;
if (map) {
map->add_agent(this);
if (avoidance_enabled) {
map->set_agent_as_controlled(this);
}
}
}
bool NavAgent::is_map_changed() {