mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
[AlternateIKSystem] Slight cleanup of BodyControls
This commit is contained in:
parent
16e44f7c35
commit
684b330a4c
4 changed files with 71 additions and 65 deletions
|
@ -14,6 +14,8 @@ public class IKManager : MonoBehaviour
|
|||
{
|
||||
public static IKManager Instance;
|
||||
|
||||
public BodyControl BodyControl = new BodyControl();
|
||||
|
||||
public static VRIK vrik => _vrik;
|
||||
private static VRIK _vrik;
|
||||
public static IKSolverVR solver => _vrik?.solver;
|
||||
|
@ -60,9 +62,7 @@ public class IKManager : MonoBehaviour
|
|||
|
||||
private void Update()
|
||||
{
|
||||
BodyControl.TrackingAll = ShouldTrackAll();
|
||||
BodyControl.TrackingUpright = GetPlayerUpright();
|
||||
BodyControl.TrackingLocomotion = ShouldTrackLocomotion();
|
||||
BodyControl.Update();
|
||||
|
||||
if (!_isAvatarInitialized)
|
||||
return;
|
||||
|
@ -171,32 +171,6 @@ public class IKManager : MonoBehaviour
|
|||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private bool ShouldTrackAll()
|
||||
{
|
||||
return !PlayerSetup.Instance._emotePlaying;
|
||||
}
|
||||
|
||||
private bool ShouldTrackLocomotion()
|
||||
{
|
||||
return !(MovementSystem.Instance.movementVector.magnitude > 0f
|
||||
|| MovementSystem.Instance.crouching
|
||||
|| MovementSystem.Instance.prone
|
||||
|| MovementSystem.Instance.flying
|
||||
|| MovementSystem.Instance.sitting
|
||||
|| !MovementSystem.Instance._isGrounded);
|
||||
}
|
||||
|
||||
private float GetPlayerUpright()
|
||||
{
|
||||
float avatarHeight = PlayerSetup.Instance._avatarHeight;
|
||||
float currentHeight = PlayerSetup.Instance.GetViewRelativePosition().y;
|
||||
return Mathf.Clamp01((avatarHeight > 0f) ? (currentHeight / avatarHeight) : 0f);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IK Initialization
|
||||
|
||||
private void InitializeDesktopIk()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue