Fixed local finger tracking with Index controllers

This commit is contained in:
SDraw 2022-11-21 17:30:01 +03:00
parent 5aef3ab83c
commit ab7f66b730
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
4 changed files with 60 additions and 42 deletions

View file

@ -57,6 +57,11 @@ namespace ml_lme
null,
new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnSetupAvatar_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
);
HarmonyInstance.Patch(
typeof(PlayerSetup).GetMethod("GetGesturesFromControllers", BindingFlags.Instance | BindingFlags.NonPublic),
null,
new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnGetGesturesFromControllers_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
);
MelonLoader.MelonCoroutines.Start(CreateTrackingObjects());
@ -356,5 +361,12 @@ namespace ml_lme
MelonLoader.MelonLogger.Error(e);
}
}
static void OnGetGesturesFromControllers_Postfix() => ms_instance?.OnGetGesturesFromControllers();
void OnGetGesturesFromControllers()
{
if(Settings.Enabled && Utils.AreKnucklesInUse() && (m_leapTracked != null))
m_leapTracked.UpdateFingers(m_gesturesData);
}
}
}