From d2ab30e7a69bfe7efda63ae75812207377917bd3 Mon Sep 17 00:00:00 2001 From: miepzerino <o.skotnik@gmail.com> Date: Sun, 30 Mar 2025 18:50:27 +0000 Subject: [PATCH] Merge branch 'Flexalon-UI-Layouts' into develop --- Assets/Flexalon/Runtime/Interaction/FlexalonXRInputProvider.cs | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/Assets/Flexalon/Runtime/Interaction/FlexalonXRInputProvider.cs b/Assets/Flexalon/Runtime/Interaction/FlexalonXRInputProvider.cs new file mode 100644 index 0000000..64a7ff3 --- /dev/null +++ b/Assets/Flexalon/Runtime/Interaction/FlexalonXRInputProvider.cs @@ -0,0 +1,31 @@ +#if UNITY_XRI + +using UnityEngine; +using UnityEngine.XR.Interaction.Toolkit; + +namespace Flexalon +{ + public class FlexalonXRInputProvider : MonoBehaviour, InputProvider + { + public InputMode InputMode => InputMode.External; + public bool Active => _selected; + public Ray Ray => default; + public Vector3 UIPointer => default; + public GameObject ExternalFocusedObject => (_hovered || _selected) ? gameObject : null; + + private XRBaseInteractable _interactable; + private bool _hovered => _interactable?.isHovered ?? false; + private bool _selected => _interactable?.isSelected ?? false; + + public void Awake() + { + _interactable = GetComponent<XRBaseInteractable>(); + if (_interactable == null) + { + Debug.LogWarning("FlexalonXRInputProvider should be placed next to an XR Interactable component."); + } + } + } +} + +#endif \ No newline at end of file -- Gitblit v1.9.3