From 3b33dc0cfb12c5abb1992ae9db5eea79d9a5e455 Mon Sep 17 00:00:00 2001 From: SDraw Date: Sun, 16 Oct 2022 15:18:54 +0300 Subject: [PATCH] No distinction between VR and desktop --- README.md | 2 +- ml_lme/LeapTracked.cs | 28 +++++++++++++--------------- ml_lme/Properties/AssemblyInfo.cs | 6 +++--- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 0b0de03..778515c 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.6 | Yes | Working | | Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working | | Four Point Tracking | ml_fpt | 1.0.8 | Yes | Working | -| Leap Motion Extension | ml_lme | 1.2.1 | Yes | Working | +| Leap Motion Extension | ml_lme | 1.2.2 | On review | Working | | Server Connection Info | ml_sci | 1.0.2 | Yes | Working | diff --git a/ml_lme/LeapTracked.cs b/ml_lme/LeapTracked.cs index 82aaf78..0a7c141 100644 --- a/ml_lme/LeapTracked.cs +++ b/ml_lme/LeapTracked.cs @@ -156,6 +156,11 @@ public void OnAvatarClear() m_vrIK = null; m_leftTargetActive = false; m_rightTargetActive = false; + + m_leftHandTarget.localPosition = Vector3.zero; + m_leftHandTarget.localRotation = Quaternion.identity; + m_rightHandTarget.localPosition = Vector3.zero; + m_rightHandTarget.localRotation = Quaternion.identity; } public void OnCalibrateAvatar() @@ -169,29 +174,22 @@ public void OnCalibrateAvatar() CVRInputManager.Instance.individualFingerTracking = (m_enabled || Utils.AreKnucklesInUse()); } - if(!PlayerSetup.Instance._inVr) - { - m_leapIK = PlayerSetup.Instance._animator.gameObject.AddComponent(); - m_leapIK.SetHands(m_leftHand, m_rightHand); - m_leapIK.SetEnabled(m_enabled); - m_leapIK.SetFingersOnly(m_fingersOnly); - } - - if((m_vrIK != null) && PlayerSetup.Instance._animator.isHuman) + if(PlayerSetup.Instance._animator.isHuman) { - // Here we fokin' go! Transform l_hand = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.LeftHand); if(l_hand != null) - { - m_leftHandTarget.localPosition = Vector3.zero; m_leftHandTarget.localRotation = ms_offsetLeft * (PlayerSetup.Instance._avatar.transform.GetMatrix().inverse * l_hand.GetMatrix()).rotation; - } l_hand = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.RightHand); if(l_hand != null) - { - m_rightHandTarget.localPosition = Vector3.zero; m_rightHandTarget.localRotation = ms_offsetRight * (PlayerSetup.Instance._avatar.transform.GetMatrix().inverse * l_hand.GetMatrix()).rotation; + + if(m_vrIK == null) + { + m_leapIK = PlayerSetup.Instance._animator.gameObject.AddComponent(); + m_leapIK.SetHands(m_leftHand, m_rightHand); + m_leapIK.SetEnabled(m_enabled); + m_leapIK.SetFingersOnly(m_fingersOnly); } } } diff --git a/ml_lme/Properties/AssemblyInfo.cs b/ml_lme/Properties/AssemblyInfo.cs index 33a5ff8..1db9b58 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.2.1")] -[assembly: AssemblyFileVersion("1.2.1")] +[assembly: AssemblyVersion("1.2.2")] +[assembly: AssemblyFileVersion("1.2.2")] -[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.2.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.2.2", "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)]