Minor fixes

This commit is contained in:
SDraw 2023-04-11 09:46:27 +03:00
parent 73b09dd5fb
commit 9a262b2ded
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
2 changed files with 8 additions and 11 deletions

View file

@ -93,7 +93,7 @@ namespace ml_prm
if(m_enabled && m_avatarReady && BodySystem.isCalibratedAsFullBody)
BodySystem.TrackingPositionWeight = 0f;
if(!m_enabled && m_avatarReady && (m_customTrigger != null) && m_customTrigger.GetStateWithReset() && Settings.PointersReaction)
if((m_customTrigger != null) && m_customTrigger.GetStateWithReset() && !m_enabled && m_avatarReady && Settings.PointersReaction)
SwitchRagdoll();
}
@ -277,7 +277,8 @@ namespace ml_prm
foreach(Rigidbody l_body in m_rigidBodies)
{
l_body.drag = p_value;
l_body.WakeUp();
if(m_enabled)
l_body.WakeUp();
}
}
}
@ -288,7 +289,8 @@ namespace ml_prm
foreach(Rigidbody l_body in m_rigidBodies)
{
l_body.angularDrag = p_value;
l_body.WakeUp();
if(m_enabled)
l_body.WakeUp();
}
}
}
@ -309,10 +311,10 @@ namespace ml_prm
m_enabled = !m_enabled;
MovementSystem.Instance.SetImmobilized(m_enabled);
PlayerSetup.Instance.animatorManager.SetAnimatorParameterTrigger("CancelEmote");
if(m_enabled)
{
PlayerSetup.Instance.animatorManager.SetAnimatorParameterTrigger("CancelEmote");
if(BodySystem.isCalibratedAsFullBody)
BodySystem.TrackingPositionWeight = 0f;

View file

@ -6,20 +6,15 @@ namespace ml_prm
[DisallowMultipleComponent]
class RagdollTrigger : MonoBehaviour
{
static int ms_localPlayerLayer = 0;
static readonly int ms_localPlayerLayer = LayerMask.NameToLayer("PlayerLocal");
Collider m_lastCollider = null;
bool m_triggered = false;
void Start()
{
ms_localPlayerLayer = LayerMask.NameToLayer("PlayerLocal");
}
void OnTriggerEnter(Collider p_other)
{
CVRPointer l_pointer = p_other.gameObject.GetComponent<CVRPointer>();
if((l_pointer != null) && l_pointer.type == "ragdoll" && p_other.gameObject.layer == ms_localPlayerLayer && (m_lastCollider != p_other))
if((l_pointer != null) && (l_pointer.type == "ragdoll") && (p_other.gameObject.layer == ms_localPlayerLayer) && (m_lastCollider != p_other))
{
m_lastCollider = p_other;
m_triggered = true;