From eb446629359360810eb8862ca0541d21c011a6bf Mon Sep 17 00:00:00 2001 From: SDraw Date: Wed, 24 Jan 2024 08:08:05 +0300 Subject: [PATCH] Fix of velocity when ragdolling in flight mode --- ml_prm/RagdollController.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ml_prm/RagdollController.cs b/ml_prm/RagdollController.cs index 93a31fb..d476751 100644 --- a/ml_prm/RagdollController.cs +++ b/ml_prm/RagdollController.cs @@ -418,6 +418,7 @@ namespace ml_prm m_forcedSwitch = true; SwitchRagdoll(); m_forcedSwitch = false; + ResetStates(); } } @@ -428,6 +429,7 @@ namespace ml_prm m_forcedSwitch = true; SwitchRagdoll(); m_forcedSwitch = false; + ResetStates(); } } @@ -452,18 +454,19 @@ namespace ml_prm m_forcedSwitch = true; SwitchRagdoll(); m_forcedSwitch = false; + ResetStates(false); } } internal void OnChangeFlight() { - ResetStates(); - if(m_avatarReady && m_enabled && MovementSystem.Instance.flying) { m_forcedSwitch = true; SwitchRagdoll(); m_forcedSwitch = false; + + ResetStates(false); } } @@ -671,10 +674,14 @@ namespace ml_prm public bool IsRagdolled() => (m_avatarReady && m_enabled); - void ResetStates() + void ResetStates(bool p_resetVelocity = true) { - m_lastPosition = this.transform.position; - m_velocity = Vector3.zero; + if(p_resetVelocity) + { + m_lastPosition = this.transform.position; + m_velocity = Vector3.zero; + } + m_inAir = false; m_inAirDistance = 0f; }