Skip to content

Commit

Permalink
No distinction between VR and desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
SDraw committed Oct 16, 2022
1 parent 593e57e commit 3b33dc0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
28 changes: 13 additions & 15 deletions ml_lme/LeapTracked.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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<LeapIK>();
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<LeapIK>();
m_leapIK.SetHands(m_leftHand, m_rightHand);
m_leapIK.SetEnabled(m_enabled);
m_leapIK.SetFingersOnly(m_fingersOnly);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions ml_lme/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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)]

0 comments on commit 3b33dc0

Please sign in to comment.