From 027e6c29cd53d9a1e326a95d19edfd9faf2162a7 Mon Sep 17 00:00:00 2001 From: SDraw Date: Tue, 27 Dec 2022 00:12:29 +0300 Subject: [PATCH] Avatars position fix --- README.md | 2 +- ml_lme/LeapTracked.cs | 12 ++++++++++++ ml_lme/Properties/AssemblyInfo.cs | 6 +++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 39ff805..72a6cb2 100644 --- a/README.md +++ b/README.md @@ -8,5 +8,5 @@ Merged set of MelonLoader mods for ChilloutVR. | Desktop Head Tracking | ml_dht | 1.1.1 | Yes | Working | | Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working | | Four Point Tracking | ml_fpt | 1.0.9 | Retired | Deprecated | In-game feature since 2022r170 update -| Leap Motion Extension | ml_lme | 1.2.8 | Yes | Working | +| Leap Motion Extension | ml_lme | 1.2.9 | Yes, pending 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 1e1f193..ee1d0ae 100644 --- a/ml_lme/LeapTracked.cs +++ b/ml_lme/LeapTracked.cs @@ -23,6 +23,8 @@ namespace ml_lme bool m_isInVR = false; Transform m_origElbowLeft = null; Transform m_origElbowRight = null; + Transform m_hips = null; + Vector3 m_hipsLocal = Vector3.zero; bool m_enabled = true; bool m_fingersOnly = false; @@ -204,9 +206,15 @@ namespace ml_lme { if(m_enabled && !m_isInVR && (m_poseHandler != null)) { + if(m_hips != null) + m_hipsLocal = m_hips.localPosition; + m_poseHandler.GetHumanPose(ref m_pose); UpdateFingers(p_data); m_poseHandler.SetHumanPose(ref m_pose); + + if(m_hips != null) + m_hips.localPosition = m_hipsLocal; } } @@ -274,6 +282,8 @@ namespace ml_lme m_vrIK = null; m_origElbowLeft = null; m_origElbowRight = null; + m_hips = null; + m_hipsLocal = Vector3.zero; m_armsWeights = Vector2.zero; m_leftIK = null; m_rightIK = null; @@ -299,6 +309,8 @@ namespace ml_lme if(PlayerSetup.Instance._animator.isHuman) { + m_hips = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.Hips); + if(!m_isInVR) { // Force desktop avatar into T-Pose diff --git a/ml_lme/Properties/AssemblyInfo.cs b/ml_lme/Properties/AssemblyInfo.cs index e4713ca..ea10aad 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.8")] -[assembly: AssemblyFileVersion("1.2.8")] +[assembly: AssemblyVersion("1.2.9")] +[assembly: AssemblyFileVersion("1.2.9")] -[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.2.8", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.2.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)]