LeapCSharp update to 6.14.0

Fixed interaction input
This commit is contained in:
SDraw 2024-01-28 14:33:12 +03:00
parent f3aa0bc72d
commit 56686834d0
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
32 changed files with 89 additions and 34 deletions

View file

@ -1,4 +1,5 @@
using ABI_RC.Core.InteractionSystem; using ABI.CCK.Components;
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Core.Player; using ABI_RC.Core.Player;
using ABI_RC.Core.Savior; using ABI_RC.Core.Savior;
using ABI_RC.Systems.IK; using ABI_RC.Systems.IK;
@ -34,11 +35,13 @@ namespace ml_lme
m_handRayLeft = LeapTracking.Instance.GetLeftHand().gameObject.AddComponent<ControllerRay>(); m_handRayLeft = LeapTracking.Instance.GetLeftHand().gameObject.AddComponent<ControllerRay>();
m_handRayLeft.hand = true; m_handRayLeft.hand = true;
m_handRayLeft.generalMask = -1485; m_handRayLeft.generalMask = -269;
m_handRayLeft.isInteractionRay = true; m_handRayLeft.isInteractionRay = true;
m_handRayLeft.triggerGazeEvents = false; m_handRayLeft.triggerGazeEvents = false;
m_handRayLeft.holderRoot = m_handRayLeft.gameObject; m_handRayLeft.holderRoot = m_handRayLeft.gameObject;
m_handRayLeft.attachmentDistance = 0f; m_handRayLeft.attachmentDistance = 0f;
m_handRayLeft.uiMask = 32;
m_handRayLeft.isDesktopRay = true;
m_lineLeft = m_handRayLeft.gameObject.AddComponent<LineRenderer>(); m_lineLeft = m_handRayLeft.gameObject.AddComponent<LineRenderer>();
m_lineLeft.endWidth = 1f; m_lineLeft.endWidth = 1f;
@ -54,11 +57,13 @@ namespace ml_lme
m_handRayRight = LeapTracking.Instance.GetRightHand().gameObject.AddComponent<ControllerRay>(); m_handRayRight = LeapTracking.Instance.GetRightHand().gameObject.AddComponent<ControllerRay>();
m_handRayRight.hand = false; m_handRayRight.hand = false;
m_handRayRight.generalMask = -1485; m_handRayRight.generalMask = -269;
m_handRayRight.isInteractionRay = true; m_handRayRight.isInteractionRay = true;
m_handRayRight.triggerGazeEvents = false; m_handRayRight.triggerGazeEvents = false;
m_handRayRight.holderRoot = m_handRayRight.gameObject; m_handRayRight.holderRoot = m_handRayRight.gameObject;
m_handRayRight.attachmentDistance = 0f; m_handRayRight.attachmentDistance = 0f;
m_handRayRight.uiMask = 32;
m_handRayRight.isDesktopRay = true;
m_lineRight = m_handRayRight.gameObject.AddComponent<LineRenderer>(); m_lineRight = m_handRayRight.gameObject.AddComponent<LineRenderer>();
m_lineRight.endWidth = 1f; m_lineRight.endWidth = 1f;
@ -72,6 +77,9 @@ namespace ml_lme
m_lineRight.receiveShadows = false; m_lineRight.receiveShadows = false;
m_handRayRight.lineRenderer = m_lineRight; m_handRayRight.lineRenderer = m_lineRight;
m_handRayLeft.otherRay = m_handRayRight;
m_handRayRight.otherRay = m_handRayLeft;
Settings.EnabledChange += this.OnEnableChange; Settings.EnabledChange += this.OnEnableChange;
Settings.InteractionChange += this.OnInteractionChange; Settings.InteractionChange += this.OnInteractionChange;
Settings.GesturesChange += this.OnGesturesChange; Settings.GesturesChange += this.OnGesturesChange;
@ -108,8 +116,11 @@ namespace ml_lme
m_lineLeft.material = PlayerSetup.Instance.vrRayLeft.lineRenderer.material; m_lineLeft.material = PlayerSetup.Instance.vrRayLeft.lineRenderer.material;
m_lineLeft.gameObject.layer = PlayerSetup.Instance.vrRayLeft.gameObject.layer; m_lineLeft.gameObject.layer = PlayerSetup.Instance.vrRayLeft.gameObject.layer;
m_handRayLeft.highlightMaterial = PlayerSetup.Instance.vrRayLeft.highlightMaterial;
m_lineRight.material = PlayerSetup.Instance.vrRayLeft.lineRenderer.material; m_lineRight.material = PlayerSetup.Instance.vrRayLeft.lineRenderer.material;
m_lineRight.gameObject.layer = PlayerSetup.Instance.vrRayLeft.gameObject.layer; m_lineRight.gameObject.layer = PlayerSetup.Instance.vrRayLeft.gameObject.layer;
m_handRayLeft.highlightMaterial = PlayerSetup.Instance.vrRayLeft.highlightMaterial;
} }
public override void ModuleDestroyed() public override void ModuleDestroyed()
@ -413,6 +424,23 @@ namespace ml_lme
m_handRayRight.SetRayScale(p_scale); m_handRayRight.SetRayScale(p_scale);
} }
internal void OnPickupGrab(CVRPickupObject p_pickup)
{
if(p_pickup.gripType == CVRPickupObject.GripType.Origin)
{
if(p_pickup._controllerRay == m_handRayLeft)
{
m_handRayLeft.attachmentPoint.localPosition = Vector3.zero;
m_handRayLeft.attachmentPoint.localRotation = Quaternion.Euler(0f, 0f, 270f);
}
if(p_pickup._controllerRay == m_handRayRight)
{
m_handRayRight.attachmentPoint.localPosition = Vector3.zero;
m_handRayRight.attachmentPoint.localRotation = Quaternion.Euler(0f, 0f, 90f);
}
}
}
// Arbitrary // Arbitrary
void SetFingersInput(LeapParser.HandData p_hand, bool p_left) void SetFingersInput(LeapParser.HandData p_hand, bool p_left)
{ {

View file

@ -1,4 +1,5 @@
using ABI_RC.Core.Player; using ABI.CCK.Components;
using ABI_RC.Core.Player;
using ABI_RC.Systems.InputManagement; using ABI_RC.Systems.InputManagement;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;
@ -196,6 +197,11 @@ namespace ml_lme
m_leapTracking.OnPlayspaceScale(p_relation); m_leapTracking.OnPlayspaceScale(p_relation);
} }
internal void OnPickupGrab(CVRPickupObject p_pickup)
{
m_leapInput?.OnPickupGrab(p_pickup);
}
// Arbitrary // Arbitrary
void UpdateDeviceTrackingMode() void UpdateDeviceTrackingMode()
{ {

View file

@ -1,4 +1,5 @@
using ABI_RC.Core.Player; using ABI.CCK.Components;
using ABI_RC.Core.Player;
using System.Collections; using System.Collections;
using System.Reflection; using System.Reflection;
using UnityEngine; using UnityEngine;
@ -42,6 +43,12 @@ namespace ml_lme
null, null,
new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnPlayspaceScale_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnPlayspaceScale_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
); );
HarmonyInstance.Patch(
typeof(CVRPickupObject).GetMethod(nameof(CVRPickupObject.Grab), BindingFlags.Public | BindingFlags.Instance),
null,
new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnPickupGrab_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
);
ModSupporter.Init(); ModSupporter.Init();
MelonLoader.MelonCoroutines.Start(WaitForRootLogic()); MelonLoader.MelonCoroutines.Start(WaitForRootLogic());
@ -121,5 +128,19 @@ namespace ml_lme
MelonLoader.MelonLogger.Error(e); MelonLoader.MelonLogger.Error(e);
} }
} }
static void OnPickupGrab_Postfix(ref CVRPickupObject __instance) => ms_instance?.OnPickupGrab(__instance);
void OnPickupGrab(CVRPickupObject p_pickup)
{
try
{
if(m_leapManager != null)
m_leapManager.OnPickupGrab(p_pickup);
}
catch(System.Exception e)
{
MelonLoader.MelonLogger.Error(e);
}
}
} }
} }

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *

View file

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2023. * * Copyright (C) Ultraleap, Inc. 2011-2024. *
* * * *
* Use subject to the terms of the Apache License 2.0 available at * * Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *