#if PICO_SDK || PXR_SDK using Unity.XR.PXR; using UnityEngine; public class PXR_PicoHandPinchGesture : PicoHandDeviceDoEvent { public HandType handType; private HandAimState aimState = new HandAimState(); private bool aimRayTouched = false; private bool pinch = false; public bool AimRayTouched { get => aimRayTouched; set => aimRayTouched = value; } public float PinchStrength { get; private set; } public bool Pinch { get => pinch; set { if (pinch != value) { if (value) { GripOn(); } else { GripOff(); } } pinch = value; } } void Update() { UpdateAimState(); } private void UpdateAimState() { if (PXR_HandTracking.GetAimState(handType, ref aimState)) { PinchStrength = aimState.touchStrengthRay; AimRayTouched = (aimState.aimStatus & HandAimStatus.AimRayTouched) != 0; if (PinchStrength > 0.6f || AimRayTouched) { Pinch = true; } else { Pinch = false; } } } } #else using UnityEngine; public class PXR_PicoHandPinchGesture : PicoHandDeviceDoEvent { } #endif