Fix for latest build

This commit is contained in:
SDraw 2022-10-02 15:04:01 +03:00
parent 24849e25ca
commit d11bf46f1a
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
4 changed files with 18 additions and 19 deletions

View file

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

View file

@ -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<IndexIK>();
m_ikCalibrator = this.GetComponent<CVR_IK_Calibrator>();
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<VRIK>();
@ -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;
}
}

View file

@ -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);
}

View file

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