mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Ported from godot4: Fix NavigationAgent position not always updating
Fixes NavigationAgent position not always updating.
- smix8
34bc410fb4
This commit is contained in:
parent
8485b37515
commit
e2fd645a42
@ -255,11 +255,14 @@ void NavigationAgent2D::_notification(int p_what) {
|
|||||||
#endif // DEBUG_ENABLED
|
#endif // DEBUG_ENABLED
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
|
if (agent_parent && avoidance_enabled) {
|
||||||
|
Navigation2DServer::get_singleton()->agent_set_position(agent, agent_parent->get_global_position());
|
||||||
|
}
|
||||||
|
|
||||||
if (agent_parent && target_position_submitted) {
|
if (agent_parent && target_position_submitted) {
|
||||||
if (velocity_submitted) {
|
if (velocity_submitted) {
|
||||||
velocity_submitted = false;
|
velocity_submitted = false;
|
||||||
if (avoidance_enabled) {
|
if (avoidance_enabled) {
|
||||||
Navigation2DServer::get_singleton()->agent_set_position(agent, agent_parent->get_global_position());
|
|
||||||
Navigation2DServer::get_singleton()->agent_set_velocity(agent, velocity);
|
Navigation2DServer::get_singleton()->agent_set_velocity(agent, velocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,11 +267,14 @@ void NavigationAgent::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
|
if (agent_parent && avoidance_enabled) {
|
||||||
|
NavigationServer::get_singleton()->agent_set_position(agent, agent_parent->get_global_transform().origin);
|
||||||
|
}
|
||||||
|
|
||||||
if (agent_parent && target_position_submitted) {
|
if (agent_parent && target_position_submitted) {
|
||||||
if (velocity_submitted) {
|
if (velocity_submitted) {
|
||||||
velocity_submitted = false;
|
velocity_submitted = false;
|
||||||
if (avoidance_enabled) {
|
if (avoidance_enabled) {
|
||||||
NavigationServer::get_singleton()->agent_set_position(agent, agent_parent->get_global_transform().origin);
|
|
||||||
if (!use_3d_avoidance) {
|
if (!use_3d_avoidance) {
|
||||||
stored_y_velocity = velocity.y;
|
stored_y_velocity = velocity.y;
|
||||||
velocity.y = 0.0;
|
velocity.y = 0.0;
|
||||||
|
Loading…
Reference in New Issue
Block a user