12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System.Collections;
- using System.Collections.Generic;
- using SC.XR.Unity.Module_InputSystem;
- using UnityEngine;
- using UnityEngine.XR.VisionOS;
- using UnityEngine.XR.VisionOS.InputDevices;
- public class VisionOSInputManager : MonoBehaviour
- {
- PointerInput m_PointerInput;
- void OnEnable()
- {
- m_PointerInput ??= new PointerInput();
- m_PointerInput.Enable();
- }
- void OnDisable()
- {
- m_PointerInput.Disable();
- }
- void Update()
- {
- var primaryTouch = m_PointerInput.Default.PrimaryPointer.ReadValue<VisionOSSpatialPointerState>();
- var phase = primaryTouch.phase;
- var began = phase == VisionOSSpatialPointerPhase.Began;
- var ended = phase == VisionOSSpatialPointerPhase.Ended;
- var active = began || phase == VisionOSSpatialPointerPhase.Moved;
- if (began)
- {
- API_GSXR_Module_InputSystem_Head.GSXR_Head.inputDataHead.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- Debug.Log("beganbeganbeganbeganbegan");
- }
- if (ended)
- {
- API_GSXR_Module_InputSystem_Head.GSXR_Head.inputDataHead.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- Debug.Log("endedendedendedendedendedended");
- }
- if (active)
- {
- }
- }
- }
|