1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add agent pause mode to NavigationServer

Adds agent pause mode to NavigationServer.
This commit is contained in:
smix8
2023-06-15 15:35:53 +02:00
parent a83eb16fba
commit ae9dd47d0c
20 changed files with 194 additions and 26 deletions

View File

@@ -628,6 +628,11 @@ bool NavMap::has_obstacle(NavObstacle *obstacle) const {
}
void NavMap::add_obstacle(NavObstacle *obstacle) {
if (obstacle->get_paused()) {
// No point in adding a paused obstacle, it will add itself when unpaused again.
return;
}
if (!has_obstacle(obstacle)) {
obstacles.push_back(obstacle);
obstacles_dirty = true;
@@ -644,6 +649,12 @@ void NavMap::remove_obstacle(NavObstacle *obstacle) {
void NavMap::set_agent_as_controlled(NavAgent *agent) {
remove_agent_as_controlled(agent);
if (agent->get_paused()) {
// No point in adding a paused agent, it will add itself when unpaused again.
return;
}
if (agent->get_use_3d_avoidance()) {
int64_t agent_3d_index = active_3d_avoidance_agents.find(agent);
if (agent_3d_index < 0) {