using System.Collections; using System.Collections.Generic; using UnityEngine; using SC.XR.Unity.Module_InputSystem; public class KeyLongPressSetOrigin : MonoBehaviour { public enum SetOriginType { Head, World, Other, } public SetOriginType setOriginType = SetOriginType.Head; // Start is called before the first frame update void Start() { DispatcherBase.KeyLongDelegateRegister(AnyKeyEventDelegate); } // Update is called once per frame void Update() { } void OnDestroy() { DispatcherBase.KeyLongDelegateUnRegister(AnyKeyEventDelegate); } void AnyKeyEventDelegate(InputKeyCode keyCode, InputDevicePartBase part) { if (setOriginType == SetOriginType.Head) { if (keyCode == InputKeyCode.Enter && part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject) { API_GSXR_Slam.GSXR_Set_HeadOrigin(part.inputDataBase.SCPointEventData.pointerCurrentRaycast.worldPosition); } } else if (setOriginType == SetOriginType.World) { if (keyCode == InputKeyCode.Enter && part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject) { API_GSXR_Slam.GSXR_Set_WorldOrigin(part.inputDataBase.SCPointEventData.pointerCurrentRaycast.worldPosition); } } } }