diff --git a/ml_lme_cvr/LeapIK.cs b/ml_lme_cvr/LeapIK.cs index c15d153..8e3b1b9 100644 --- a/ml_lme_cvr/LeapIK.cs +++ b/ml_lme_cvr/LeapIK.cs @@ -4,7 +4,7 @@ namespace ml_lme_cvr { [RequireComponent(typeof(Animator))] [DisallowMultipleComponent] - public class LeapIK : MonoBehaviour + class LeapIK : MonoBehaviour { bool m_enabled = true; bool m_fingersOnly = false; diff --git a/ml_lme_cvr/Main.cs b/ml_lme_cvr/Main.cs index e4abe4f..e6ab840 100644 --- a/ml_lme_cvr/Main.cs +++ b/ml_lme_cvr/Main.cs @@ -12,6 +12,7 @@ namespace ml_lme_cvr static LeapMotionExtension ms_instance = null; Leap.Controller m_leapController = null; + long m_lastFrameId = 0; GestureMatcher.GesturesData m_gesturesData = null; GameObject m_leapTrackingRoot = null; @@ -102,11 +103,15 @@ namespace ml_lme_cvr { if(Settings.Enabled && (m_leapController != null)) { - Leap.Frame l_frame = m_leapController.Frame(); - if(l_frame != null) - { - GestureMatcher.GetGestures(l_frame, ref m_gesturesData); + for(int i = 0; i < GestureMatcher.GesturesData.ms_handsCount; i++) + m_gesturesData.m_handsPresenses[i] = false; + Leap.Frame l_frame = m_leapController.Frame(); + if((l_frame != null) && (m_lastFrameId != l_frame.Id)) + { + m_lastFrameId = l_frame.Id; + + GestureMatcher.GetGestures(l_frame, ref m_gesturesData); for(int i = 0; i < GestureMatcher.GesturesData.ms_handsCount; i++) { if((m_leapHands[i] != null) && m_gesturesData.m_handsPresenses[i]) @@ -119,11 +124,6 @@ namespace ml_lme_cvr } } } - else - { - for(int i = 0; i < GestureMatcher.GesturesData.ms_handsCount; i++) - m_gesturesData.m_handsPresenses[i] = false; - } if(m_leapTracked != null) m_leapTracked.UpdateTracking(m_gesturesData); diff --git a/ml_lme_cvr/Properties/AssemblyInfo.cs b/ml_lme_cvr/Properties/AssemblyInfo.cs index d357e8f..2ca0168 100644 --- a/ml_lme_cvr/Properties/AssemblyInfo.cs +++ b/ml_lme_cvr/Properties/AssemblyInfo.cs @@ -1,10 +1,10 @@ using System.Reflection; [assembly: AssemblyTitle("LeapMotionExtension")] -[assembly: AssemblyVersion("1.0.1")] -[assembly: AssemblyFileVersion("1.0.1")] +[assembly: AssemblyVersion("1.0.2")] +[assembly: AssemblyFileVersion("1.0.2")] -[assembly: MelonLoader.MelonInfo(typeof(ml_lme_cvr.LeapMotionExtension), "LeapMotionExtension", "1.0.1", "SDraw", "https://github.com/SDraw")] +[assembly: MelonLoader.MelonInfo(typeof(ml_lme_cvr.LeapMotionExtension), "LeapMotionExtension", "1.0.2", "SDraw", "https://github.com/SDraw")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]