No distinction between VR and desktop

This commit is contained in:
SDraw 2022-10-16 15:18:54 +03:00
parent 593e57e54b
commit 3b33dc0cfb
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
3 changed files with 17 additions and 19 deletions

View file

@ -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 |

View file

@ -156,6 +156,11 @@ namespace ml_lme
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 @@ namespace ml_lme
CVRInputManager.Instance.individualFingerTracking = (m_enabled || Utils.AreKnucklesInUse());
}
if(!PlayerSetup.Instance._inVr)
if(PlayerSetup.Instance._animator.isHuman)
{
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)
{
// 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);
}
}
}

View file

@ -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)]