diff --git a/README.md b/README.md index 56c2065..6950548 100644 --- a/README.md +++ b/README.md @@ -8,5 +8,5 @@ Merged set of MelonLoader mods for ChilloutVR. | Desktop Head Tracking | ml_dht | 1.0.3 | On review | Working | | Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working | | Four Point Tracking | ml_fpt | 1.0.7 | On review | Working | -| Leap Motion Extension | ml_lme | 1.1.8 | Yes | Working partially | No tracking in VR | +| Leap Motion Extension | ml_lme | 1.1.9 | On review | Working | | Server Connection Info | ml_sci | 1.0.1 | Yes | Working | diff --git a/ml_lme/LeapTracked.cs b/ml_lme/LeapTracked.cs index c9a7f52..c1f5205 100644 --- a/ml_lme/LeapTracked.cs +++ b/ml_lme/LeapTracked.cs @@ -1,5 +1,6 @@ using ABI_RC.Core.Player; using ABI_RC.Core.Savior; +using ABI_RC.Systems.IK; using RootMotion.FinalIK; using UnityEngine; @@ -8,11 +9,10 @@ namespace ml_lme [DisallowMultipleComponent] class LeapTracked : MonoBehaviour { - static readonly Quaternion ms_offsetLeft = Quaternion.Euler(0f, 90f, 330f); - static readonly Quaternion ms_offsetRight = Quaternion.Euler(0f, 270f, 30f); + static readonly Quaternion ms_offsetLeft = Quaternion.Euler(0f, 0f, 270f); + static readonly Quaternion ms_offsetRight = Quaternion.Euler(0f, 0f, 90f); IndexIK m_indexIK = null; - CVR_IK_Calibrator m_ikCalibrator = null; VRIK m_vrIK = null; bool m_enabled = true; @@ -29,7 +29,6 @@ namespace ml_lme void Start() { m_indexIK = this.GetComponent(); - m_ikCalibrator = this.GetComponent(); if(m_leftHand != null) { @@ -133,7 +132,7 @@ namespace ml_lme } if(!p_gesturesData.m_handsPresenses[0] && m_leftTargetActive) { - m_vrIK.solver.leftArm.target = m_ikCalibrator.leftHandAnchor; + m_vrIK.solver.leftArm.target = IKSystem.Instance.leftHandAnchor; m_leftTargetActive = false; } @@ -144,7 +143,7 @@ namespace ml_lme } if(!p_gesturesData.m_handsPresenses[1] && m_rightTargetActive) { - m_vrIK.solver.rightArm.target = m_ikCalibrator.rightHandAnchor; + m_vrIK.solver.rightArm.target = IKSystem.Instance.rightHandAnchor; m_rightTargetActive = false; } } @@ -159,7 +158,7 @@ namespace ml_lme m_rightTargetActive = false; } - public void OnSetupAvatarGeneral() + public void OnCalibrateAvatar() { m_vrIK = PlayerSetup.Instance._animator.GetComponent(); @@ -217,16 +216,16 @@ namespace ml_lme void RestoreIK() { - if((m_ikCalibrator != null) && (m_vrIK != null)) + if(m_vrIK != null) { if(m_leftTargetActive) { - m_vrIK.solver.leftArm.target = m_ikCalibrator.leftHandAnchor; + m_vrIK.solver.leftArm.target = IKSystem.Instance.leftHandAnchor; m_leftTargetActive = false; } if(m_rightTargetActive) { - m_vrIK.solver.rightArm.target = m_ikCalibrator.rightHandAnchor; + m_vrIK.solver.rightArm.target = IKSystem.Instance.rightHandAnchor; m_rightTargetActive = false; } } diff --git a/ml_lme/Main.cs b/ml_lme/Main.cs index 23b7262..7f250a2 100644 --- a/ml_lme/Main.cs +++ b/ml_lme/Main.cs @@ -54,9 +54,9 @@ namespace ml_lme new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnAvatarClear_Postfix), System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)) ); HarmonyInstance.Patch( - typeof(PlayerSetup).GetMethod("SetupAvatarGeneral", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic), + typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.CalibrateAvatar)), null, - new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnSetupAvatarGeneral_Postfix), System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)) + new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnCalibrateAvatar_Postfix), System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)) ); @@ -329,13 +329,13 @@ namespace ml_lme } // Sneaky forced IndexIK calibration - static void OnSetupAvatarGeneral_Postfix() => ms_instance?.OnSetupAvatarGeneral(); - void OnSetupAvatarGeneral() + static void OnCalibrateAvatar_Postfix() => ms_instance?.OnCalibrateAvatar(); + void OnCalibrateAvatar() { try { if(m_leapTracked != null) - m_leapTracked.OnSetupAvatarGeneral(); + m_leapTracked.OnCalibrateAvatar(); OnSettingsHeadAttachChange(Settings.HeadAttach); } diff --git a/ml_lme/Properties/AssemblyInfo.cs b/ml_lme/Properties/AssemblyInfo.cs index e22aa49..9fa4e00 100644 --- a/ml_lme/Properties/AssemblyInfo.cs +++ b/ml_lme/Properties/AssemblyInfo.cs @@ -1,10 +1,10 @@ using System.Reflection; [assembly: AssemblyTitle("LeapMotionExtension")] -[assembly: AssemblyVersion("1.1.8")] -[assembly: AssemblyFileVersion("1.1.8")] +[assembly: AssemblyVersion("1.1.9")] +[assembly: AssemblyFileVersion("1.1.9")] -[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.1.8", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.1.9", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]