From aac479fc6759b183fe9ef9f9a57d030ce0b3d1bf Mon Sep 17 00:00:00 2001 From: Gordon MacPherson Date: Thu, 21 Nov 2024 14:35:23 +0000 Subject: [PATCH] Fix character crashes which can happen during join/leaving sequence This crash was happening the moment a player was joining but had not received the entire snapshot or the world. --- modules/network_synchronizer | 2 +- modules/the_mirror/physics/tm_character_3d.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/network_synchronizer b/modules/network_synchronizer index c1e955e3ec6f..6181debadc38 160000 --- a/modules/network_synchronizer +++ b/modules/network_synchronizer @@ -1 +1 @@ -Subproject commit c1e955e3ec6f143f9b040208efb3fac389661c8f +Subproject commit 6181debadc38d4cedf540e16936b9fd2c8c5b6e5 diff --git a/modules/the_mirror/physics/tm_character_3d.cpp b/modules/the_mirror/physics/tm_character_3d.cpp index 7b3142b2d294..95cafa78a626 100644 --- a/modules/the_mirror/physics/tm_character_3d.cpp +++ b/modules/the_mirror/physics/tm_character_3d.cpp @@ -179,6 +179,11 @@ void TMCharacter3D::process_character( // Make sure this character doesn't disappear while simulating, no matter what. notify_received_net_sync_update(); + update_virtual_character(); + if (!virtual_character) { + return; + } + if (frozen) { // Nothing to update. const JPH::RVec3 Pos = virtual_character->GetPosition(); @@ -190,11 +195,6 @@ void TMCharacter3D::process_character( return; } - update_virtual_character(); - if (!virtual_character) { - return; - } - // Update the GroudVelocity. Jolt::singleton()->character_virtual_pre_step( float(p_delta),