Added a unity editor script to toggle ragdoll via animation on your avatar

This commit is contained in:
kafeijao 2023-04-08 19:31:57 +01:00
parent 76f9244d9c
commit e426418806
No known key found for this signature in database
GPG key ID: E99978723E454B4C
6 changed files with 39 additions and 0 deletions

View file

@ -30,6 +30,8 @@ namespace ml_prm
Vector3 m_lastPosition = Vector3.zero;
Vector3 m_velocity = Vector3.zero;
RagdollToggle m_avatarRagdollToggle = null;
internal RagdollController()
{
m_rigidBodies = new List<Rigidbody>();
@ -67,6 +69,11 @@ namespace ml_prm
if(Settings.Hotkey && Input.GetKeyDown(KeyCode.R) && !ViewManager.Instance.isGameMenuOpen())
SwitchRagdoll();
if (m_avatarRagdollToggle != null && m_avatarRagdollToggle.isActiveAndEnabled && m_avatarRagdollToggle.shouldOverride) {
if (m_enabled != m_avatarRagdollToggle.isOn)
SwitchRagdoll();
}
}
void LateUpdate()
@ -182,6 +189,8 @@ namespace ml_prm
m_vrIK.onPostSolverUpdate.AddListener(this.OnIKPostUpdate);
}
m_avatarRagdollToggle = PlayerSetup.Instance._avatar.GetComponentInChildren<RagdollToggle>(true);
m_avatarReady = true;
}
}