Pose transitions in FBT with enabled game's option for running FBT animations

Limit movement drag to 50
Settings listener on destroy
This commit is contained in:
SDraw 2023-04-09 13:59:53 +00:00 committed by SDraw
parent 327f5d6cdd
commit fe5e1dfd3c
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
6 changed files with 28 additions and 11 deletions

View file

@ -1,4 +1,5 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Systems.IK;
using ABI_RC.Systems.IK.SubSystems;
using ABI_RC.Systems.MovementSystem;
@ -37,6 +38,7 @@ namespace ml_amt
Transform m_avatarHips = null;
float m_viewPointHeight = 1f;
bool m_inVR = false;
bool m_fbtAnimations = true;
bool m_avatarReady = false;
bool m_compatibleAvatar = false;
@ -93,6 +95,9 @@ namespace ml_amt
Settings.FollowHipsChange += this.SetFollowHips;
Settings.MassCenterChange += this.OnMassCenterChange;
Settings.ScaledStepsChange += this.OnScaledStepsChange;
m_fbtAnimations = MetaPort.Instance.settings.GetSettingsBool("GeneralEnableRunningAnimationFullBody");
MetaPort.Instance.settings.settingBoolChanged.AddListener(this.OnGameSettingBoolChange);
}
void OnDestroy()
@ -108,6 +113,8 @@ namespace ml_amt
Settings.DetectEmotesChange -= this.SetDetectEmotes;
Settings.FollowHipsChange -= this.SetFollowHips;
Settings.MassCenterChange -= this.OnMassCenterChange;
MetaPort.Instance.settings.settingBoolChanged.RemoveListener(this.OnGameSettingBoolChange);
}
void Update()
@ -147,8 +154,8 @@ namespace ml_amt
if(m_poseTransitions)
{
PlayerSetup.Instance.animatorManager.SetAnimatorParameterBool("Crouching", (m_poseState == PoseState.Crouching) && !m_compatibleAvatar && !BodySystem.isCalibratedAsFullBody);
PlayerSetup.Instance.animatorManager.SetAnimatorParameterBool("Prone", (m_poseState == PoseState.Proning) && !m_compatibleAvatar && !BodySystem.isCalibratedAsFullBody);
PlayerSetup.Instance.animatorManager.SetAnimatorParameterBool("Crouching", (m_poseState == PoseState.Crouching) && !m_compatibleAvatar && (!BodySystem.isCalibratedAsFullBody || m_fbtAnimations));
PlayerSetup.Instance.animatorManager.SetAnimatorParameterBool("Prone", (m_poseState == PoseState.Proning) && !m_compatibleAvatar && (!BodySystem.isCalibratedAsFullBody || m_fbtAnimations));
}
}
@ -441,6 +448,13 @@ namespace ml_amt
}
}
// Game settings
void OnGameSettingBoolChange(string p_name, bool p_state)
{
if(p_name == "GeneralEnableRunningAnimationFullBody")
m_fbtAnimations = p_state;
}
// Arbitrary
float GetRelativeScale()
{