#if !PICO_OPENXR_SDK /******************************************************************************* Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved. NOTICE:All information contained herein is, and remains the property of PICO Technology Co., Ltd. The intellectual and technical concepts contained herein are proprietary to PICO Technology Co., Ltd. and may be covered by patents, patents in process, and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from PICO Technology Co., Ltd. *******************************************************************************/ using System; using System.Runtime.InteropServices; using UnityEngine; #if PICO_LIVE_PREVIEW && UNITY_EDITOR using Unity.XR.PICO.LivePreview; #endif namespace Unity.XR.PXR { public static class PXR_HandTracking { /// Gets whether hand tracking is enabled or disabled. /// /// * `true`: enabled /// * `false`: disabled /// ///interface has been deprecated [Obsolete("interface has been deprecated", true)] public static bool GetSettingState() { return false; } /// Gets the current active input device. /// The current active input device: /// * `HeadActive`: HMD /// * `ControllerActive`: controllers /// * `HandTrackingActive`: hands /// public static ActiveInputDevice GetActiveInputDevice() { return PXR_Plugin.HandTracking.UPxr_GetHandTrackerActiveInputType(); } /// Gets the data about the pose of a specified hand, including the status of the ray and fingers, the strength of finger pinch and ray touch. /// The hand to get data for: /// * `HandLeft`: left hand /// * `HandRight`: right hand /// /// `HandAimState` contains the data about the poses of ray and fingers. /// If you use PICO hand prefabs without changing any of their default settings, you will get the following data: /// ```csharp /// public class PXR_Hand /// { /// // Whether the data is valid. /// public bool Computed { get; private set; } /// // The ray pose. /// public Posef RayPose { get; private set; } /// // Whether the ray was displayed. /// public bool RayValid { get; private set; } /// // Whether the ray pinched. /// public bool Pinch { get; private set; } /// // The strength of ray pinch. /// public float PinchStrength { get; private set; } /// ``` /// /// /// * `true`: success /// * `false`: failure /// public static bool GetAimState(HandType hand, ref HandAimState aimState) { if (!PXR_ProjectSetting.GetProjectConfig().handTracking) return false; return PXR_Plugin.HandTracking.UPxr_GetHandTrackerAimState(hand, ref aimState); } /// Gets the locations of joints for a specified hand. /// The hand to get joint locations for: /// * `HandLeft`: left hand /// * `HandRight`: right hand /// /// Contains data about the locations of the joints in the specified hand. /// /// * `true`: success /// * `false`: failure /// public static bool GetJointLocations(HandType hand, ref HandJointLocations jointLocations) { if (!PXR_ProjectSetting.GetProjectConfig().handTracking) return false; return PXR_Plugin.HandTracking.UPxr_GetHandTrackerJointLocations(hand, ref jointLocations); } /// /// Gets the scaling ratio of the hand model. /// /// Specifies the hand to get scaling ratio for: /// * `HandLeft`: left hand /// * `HandRight`: right hand /// /// Returns the scaling ratio for the specified hand. /// /// * `true`: success /// * `false`: failure /// public static bool GetHandScale(HandType hand,ref float scale) { return PXR_Plugin.HandTracking.UPxr_GetHandScale((int)hand, ref scale); } } } #endif