From 8263edd59284aba390aca011d25b79efecef4c48 Mon Sep 17 00:00:00 2001 From: pryazha Date: Wed, 2 Jul 2025 08:46:23 -0700 Subject: init --- .../1.14.3/Controller/Scripts/MarkLateLatchNode.cs | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/MarkLateLatchNode.cs (limited to 'Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/MarkLateLatchNode.cs') diff --git a/Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/MarkLateLatchNode.cs b/Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/MarkLateLatchNode.cs new file mode 100644 index 0000000..e5cad59 --- /dev/null +++ b/Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/MarkLateLatchNode.cs @@ -0,0 +1,49 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.XR; +using UnityEngine.XR.OpenXR.Input; +using UnityEngine.InputSystem; + +/// +/// Example code for Vulkan Late latching support. For use cases example, please check out Controller Sample - Head object, LeftHand/Aim object and RightHand/Grip object. +/// See: https://docs.unity3d.com/ScriptReference/XR.XRDisplaySubsystem.MarkTransformLateLatched.html +/// +namespace UnityEngine.XR.OpenXR.Samples.ControllerSample +{ + public class MarkLateLatchNode : MonoBehaviour + { + private XRDisplaySubsystem m_DisplaySubsystem = null; + public UnityEngine.XR.XRDisplaySubsystem.LateLatchNode lateLatchNode; + //Set one pose type InputAction for each hand to be late latched - e.g.: Aim or Grip. For head node, leave it unset. + [SerializeField] private InputActionReference _ActionReference = null; + + // Start is called before the first frame update + void Start() + { + List subsys = new List(); + SubsystemManager.GetSubsystems(subsys); + + if (subsys.Count >= 1) + m_DisplaySubsystem = subsys[0]; + if (_ActionReference != null) + { + bool result = OpenXRInput.TrySetControllerLateLatchAction(_ActionReference.action); + Debug.LogFormat("TrySetControllerLateLatchAction returns {0} for action {1}.", result, _ActionReference); + } + } + + // Update is called once per frame + void Update() + { + if (m_DisplaySubsystem != null) + { + transform.position += new Vector3(0.00001f, 0, 0); + Quaternion rot = transform.rotation; + rot.x += 0.00001f; + transform.rotation = rot; + m_DisplaySubsystem.MarkTransformLateLatched(transform, lateLatchNode); + } + } + } +} -- cgit v1.2.3-70-g09d2