mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-05 03:19:23 +00:00
IK reset after locomotion override
This commit is contained in:
parent
98af853aa0
commit
3940802858
1 changed files with 11 additions and 5 deletions
|
@ -44,6 +44,7 @@ namespace ml_amt
|
||||||
bool m_grounded = false;
|
bool m_grounded = false;
|
||||||
bool m_groundedRaw = false;
|
bool m_groundedRaw = false;
|
||||||
bool m_moving = false;
|
bool m_moving = false;
|
||||||
|
bool m_locomotionOverride = false;
|
||||||
|
|
||||||
bool m_ikOverrideCrouch = true;
|
bool m_ikOverrideCrouch = true;
|
||||||
float m_crouchLimit = 0.65f;
|
float m_crouchLimit = 0.65f;
|
||||||
|
@ -177,6 +178,7 @@ namespace ml_amt
|
||||||
m_locomotionOffset = Vector3.zero;
|
m_locomotionOffset = Vector3.zero;
|
||||||
m_emoteActive = false;
|
m_emoteActive = false;
|
||||||
m_moving = false;
|
m_moving = false;
|
||||||
|
m_locomotionOverride = false;
|
||||||
m_hipsToPlayer = Vector3.zero;
|
m_hipsToPlayer = Vector3.zero;
|
||||||
m_avatarHips = null;
|
m_avatarHips = null;
|
||||||
m_viewPointHeight = 1f;
|
m_viewPointHeight = 1f;
|
||||||
|
@ -282,7 +284,7 @@ namespace ml_amt
|
||||||
|
|
||||||
void OnIKPreUpdate()
|
void OnIKPreUpdate()
|
||||||
{
|
{
|
||||||
bool l_legsOverride = false;
|
bool l_locomotionOverride = false;
|
||||||
|
|
||||||
m_ikWeight = m_vrIk.solver.IKPositionWeight;
|
m_ikWeight = m_vrIk.solver.IKPositionWeight;
|
||||||
m_locomotionWeight = m_vrIk.solver.locomotion.weight;
|
m_locomotionWeight = m_vrIk.solver.locomotion.weight;
|
||||||
|
@ -300,31 +302,35 @@ namespace ml_amt
|
||||||
m_vrIk.solver.locomotion.weight = 0f;
|
m_vrIk.solver.locomotion.weight = 0f;
|
||||||
m_vrIk.solver.leftLeg.useAnimatedBendNormal = true;
|
m_vrIk.solver.leftLeg.useAnimatedBendNormal = true;
|
||||||
m_vrIk.solver.rightLeg.useAnimatedBendNormal = true;
|
m_vrIk.solver.rightLeg.useAnimatedBendNormal = true;
|
||||||
l_legsOverride = true;
|
l_locomotionOverride = true;
|
||||||
}
|
}
|
||||||
if(m_ikOverrideFly && MovementSystem.Instance.flying)
|
if(m_ikOverrideFly && MovementSystem.Instance.flying)
|
||||||
{
|
{
|
||||||
m_vrIk.solver.locomotion.weight = 0f;
|
m_vrIk.solver.locomotion.weight = 0f;
|
||||||
m_vrIk.solver.leftLeg.useAnimatedBendNormal = true;
|
m_vrIk.solver.leftLeg.useAnimatedBendNormal = true;
|
||||||
m_vrIk.solver.rightLeg.useAnimatedBendNormal = true;
|
m_vrIk.solver.rightLeg.useAnimatedBendNormal = true;
|
||||||
l_legsOverride = true;
|
l_locomotionOverride = true;
|
||||||
}
|
}
|
||||||
if(m_ikOverrideJump && !m_grounded && !MovementSystem.Instance.flying)
|
if(m_ikOverrideJump && !m_grounded && !MovementSystem.Instance.flying)
|
||||||
{
|
{
|
||||||
m_vrIk.solver.locomotion.weight = 0f;
|
m_vrIk.solver.locomotion.weight = 0f;
|
||||||
m_vrIk.solver.leftLeg.useAnimatedBendNormal = true;
|
m_vrIk.solver.leftLeg.useAnimatedBendNormal = true;
|
||||||
m_vrIk.solver.rightLeg.useAnimatedBendNormal = true;
|
m_vrIk.solver.rightLeg.useAnimatedBendNormal = true;
|
||||||
l_legsOverride = true;
|
l_locomotionOverride = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool l_solverActive = !Mathf.Approximately(m_vrIk.solver.IKPositionWeight, 0f);
|
bool l_solverActive = !Mathf.Approximately(m_vrIk.solver.IKPositionWeight, 0f);
|
||||||
if(l_legsOverride && l_solverActive && m_followHips && (!m_moving || (m_poseState == PoseState.Proning)) && m_inVR && !BodySystem.isCalibratedAsFullBody)
|
if(l_locomotionOverride && l_solverActive && m_followHips && (!m_moving || (m_poseState == PoseState.Proning)) && m_inVR && !BodySystem.isCalibratedAsFullBody)
|
||||||
{
|
{
|
||||||
m_vrIk.solver.plantFeet = false;
|
m_vrIk.solver.plantFeet = false;
|
||||||
ABI_RC.Systems.IK.IKSystem.VrikRootController.enabled = false;
|
ABI_RC.Systems.IK.IKSystem.VrikRootController.enabled = false;
|
||||||
PlayerSetup.Instance._avatar.transform.localPosition = m_hipsToPlayer;
|
PlayerSetup.Instance._avatar.transform.localPosition = m_hipsToPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(m_locomotionOverride && !l_locomotionOverride)
|
||||||
|
m_vrIk.solver.Reset();
|
||||||
|
m_locomotionOverride = l_locomotionOverride;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnIKPostUpdate()
|
void OnIKPostUpdate()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue