// Copyright PICO Technology Co., Ltd. All rights reserved. // This plugin incorporates portions of the UnrealĀ® Engine. UnrealĀ® is a trademark or registered trademark of Epic Games, Inc. in the United States of America and elsewhere. // Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "PXR_MotionTrackingTypes.h" #include "PXR_MotionTrackingFunctionLibrary.generated.h" UCLASS() class PICOXRMOTIONTRACKING_API UPICOXRMotionTrackingFunctionLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() public: /// /// Gets whether the current device supports face tracking. /// /// Indicates whether the device supports face tracking: /// * `true`: Support /// * `false`: Not support /// /// The EPXRFaceTrackingMode enum. Returns the face tracking modes supported by the current device. /// - `PXR_FTM_NONE = (uint8)-1`: Do not enable face tracking /// - `PXR_FTM_FACE = 0`: Image-driven mode /// - `PXR_FTM_LIPS = 1`: Audio-driven mode /// - `PXR_FTM_FACE_LIPS_VIS = 2`: Hybrid-Viseme mode /// - `PXR_FTM_FACE_LIPS_BS = 3`: Hybrid-Blendshape mode /// /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|FaceTracking") static bool GetFaceTrackingSupported(bool& Supported, TArray& SupportedModes); /// /// Gets the state of face tracking. /// @note Supported by PICO 4 Pro and PICO 4 Enterprise. /// /// Returns a bool indicating whether face tracking is working: /// * `true`: face tracking is working /// * `false`: face tracking has been stopped /// /// Returns the face tracking state information, including the face tracking mode and face tracking state code. /// - `CurrentTrackingMode`: EPXRFaceTrackingMode enum /// - `PXR_FTM_NONE = (uint8)-1`: Do not enable face tracking /// - `PXR_FTM_FACE = 0`: Image-driven mode /// - `PXR_FTM_LIPS = 1`: Audio-driven mode /// - `PXR_FTM_FACE_LIPS_VIS = 2`: Hybrid-Viseme mode /// - `PXR_FTM_FACE_LIPS_BS = 3`: Hybrid-Blendshape mode /// - `TrackingStateCode`: The [EPXRTrackingStateCode](https://developer-cn.pico-interactive.com/en/document/unreal/face-tracking/#94bd97fa) enum /// /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|FaceTracking") static bool GetFaceTrackingState(bool& IsTracking, FPXRFaceTrackingState& TrackingState); /// /// Starts face tracking. /// @note Supported by PICO 4 Pro and PICO 4 Enterprise. /// /// Passes the information for starting face tracking. Here you need to choose the face tracking mode. For details, see the above EPXRFaceTrackingMode enum. /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|FaceTracking") static bool StartFaceTracking(const FPXRFaceTrackingStartInfo& StartInfo); /// /// Stops face tracking. /// @note Supported by PICO 4 Pro and PICO 4 Enterprise. /// /// Passes the information for stopping face tracking: /// `Pause`: Bool. `true` indicates pausing face tracking and `false` indicates directly stopping face tracking. /// If you need to switch the face-tracking mode, you can set `Pause` to true and then call `StartFaceTracking` to select another mode, instead of completely stop it. /// /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|FaceTracking") static bool StopFaceTracking(const FPXRFaceTrackingStopInfo& StopInfo); /// /// Gets face tracking data. /// @note Supported by PICO 4 Pro and PICO 4 Enterprise. /// /// Specifies the face tracking data you want. /// - DisplayTime: Int. Set as the prediction time. Currently, this parameter is only supported to be set as 0. /// /// Returns the desired face tracking data: /// - `BlendShapeWeights`: See the [EPXRFaceBlendShape](https://developer-cn.pico-interactive.com/en/document/unreal/face-tracking/#ab7d460b) enum for details. /// - `TimeStamp`: Int. The time at which the data was retrieved. /// - `LaughingProb`: The probability of "laughing," ranging from 0 to 1, where 0 represents no smile, and 1 represents a hearty laugh. /// - `EyeValid`: Indicates whether the data for the eye area is valid. /// - `FaceValid`: Indicates whether the data for the facial area is valid. /// /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|FaceTracking") static bool GetFaceTrackingData(const FPXRFaceTrackingDataGetInfo& GetInfo, FPXRFaceTrackingData& OutFaceTrackingData); /// /// Gets whether the current device supports eye tracking. /// /// /// Returns a bool indicating whether eye tracking is supported: /// * `true`: Supported /// * `false`: Not supported /// /// /// Returns the eye tracking modes supported by the current device: /// `PXR_ETM_BOTH`: The device supports tracking both eyes, namely binocular-tracking mode /// `PXR_ETM_NONE`: The device does not support eye tracking /// /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|EyeTracking") static bool GetEyeTrackingSupported(bool& Supported, TArray& SupportedModes); /// /// Gets the state of eye tracking. /// @note Supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise. /// /// Returns a bool that indicates whether eye tracking is working: /// * `true`: eye tracking is working /// * `false`: eye tracking has been stopped /// /// Returns the eye tracking state information, including: /// - `CurrentTrackingMode`: The EPXREyeTrackingMode enum /// - `TrackingStateCode`: The EPXRTrackingStateCode enum /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|EyeTracking") static bool GetEyeTrackingState(bool& IsTracking, FPXREyeTrackingState& TrackingState); /// /// Starts eye tracking. /// @note Supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise. /// /// Passes the information for starting eye tracking. /// - `NeedCalibration`: Whether your app needs eye tracking calibration /// - `StartMode`: EPXREyeTrackingMode enum /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|EyeTracking") static bool StartEyeTracking(const FPXREyeTrackingStartInfo& StartInfo); /// /// Stops eye tracking. /// @note Supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise. /// /// Passes the information for stopping eye tracking. Currently, you do not need to pass anything. /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|EyeTracking") static bool StopEyeTracking(const FPXREyeTrackingStopInfo& StopInfo); /// Gets eye tracking data. /// @note Supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise. To call this API, you need to enable eye tracking first for your project. /// /// Float. Specifies how many Unreal units correspond to one meter in the real world. 100 by default. /// Specifies the eye tracking data you want: /// - DisplayTime: Int. Set as the prediction time. If DisplayTime is set to 0, the prediction time of the current frame will be used as DisplayTime. /// - QueryPosition: Bool. Whether to query the position data. /// - QueryOrientation: Bool. Whether to query the orientation data. /// /// Returns the desired eye tracking data. The structure containing the following details: /// /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|EyeTracking", meta = (WorldToMetersScale = "100.0")) static bool GetEyeTrackingData(float WorldToMetersScale, const FPXREyeTrackingDataGetInfo& GetInfo, FPXREyeTrackingData& OutEyeTrackingData); /// /// Gets the openness of the left and right eyes. /// @note Only supported by PICO 4 Enterprise. To use this API, you must add `` to the AndroidManifest.xml file. /// /// The openness of the left eye, which is a float value ranges from `0.0` to `1.0`. `0.0` indicates completely closed, `1.0` indicates completely open. /// The openness of the right eye, which is a float value ranges from `0.0` to `1.0`. `0.0` indicates completely closed, `1.0` indicates completely open. /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|EyeTracking") static bool GetEyeOpenness(float& LeftEyeOpenness, float& RightEyeOpenness); /// /// Gets the information about the pupils of both eyes. /// @note Only supported by PICO 4 Enterprise. To use this API, you must add `` to the AndroidManifest.xml file. /// /// Returns the diameters and positions of both pupils. /// - LeftEyePupilDiameter: Float. The left eye pupil diameter in pixels. /// - RightEyePupilDiameter: Float. The right eye pupil diameter in pixels. /// - LeftEyePupilPosition: FVector2D. The location of the left eye pupil on the captured image. The image's coordinate system originates at (0,0) in the top-left corner, with the positive X-axis extending to the right and the positive Y-axis extending downward, measured in pixels. /// - RightEyePupilPosition: FVector2D. The location of the right eye pupil on the captured image. The image's coordinate system originates at (0,0) in the top-left corner, with the positive X-axis extending to the right and the positive Y-axis extending downward, measured in pixels. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|EyeTracking") static bool GetEyePupilInfo(FPXREyePupilInfo& EyePupilInfo); /// /// Retrieves the per-eye pose information. /// @note Only supported by PICO 4 Enterprise. To use this API, you must add `` to the AndroidManifest.xml file. /// /// Int. The time at which the data was retrieved. /// FTransform. Indicates the location and rotation of the left eye. /// FTransform. Indicates the location and rotation of the right eye. /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|EyeTracking") static bool GetPerEyePose(int64& Timestamp, FTransform& LeftEyePose, FTransform& RightEyePose); /// /// Retrieves the eye blink information. /// @note Only supported by PICO 4 Enterprise. To use this API, you must add `` to the AndroidManifest.xml file. /// /// Int. The time at which the data was retrieved. /// Bool. Indicates whether the left eye is blinked (true) or not (false). /// Bool. Indicates whether the right eye is blinked (true) or not (false). /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|EyeTracking") static bool GetEyeBlink(int64& Timestamp, bool& bLeftBlink, bool& bRightBlink); /// /// Starts the motion tracking service. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|BodyTracking") static bool PXR_WantBodyTrackingService(); /// /// Gets whether the current device supports body tracking. /// /// /// Returns a bool indicating whether body tracking is supported: /// * `true`: Supported /// * `false`: Not supported /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|BodyTracking") static bool PXR_GetBodyTrackingSupported(bool& Supported); /// /// Gets the state of body tracking. /// /// Returns a bool that indicates whether body tracking is working: /// * `true`: Body tracking is working. /// * `false`: Body tracking has been stopped. /// /// Returns the body tracking state information, including: /// - `CurrentTrackingMode`: The EPXRBodyTrackingMode enum. /// - `TrackingStateCode`: The EPXRTrackingStateCode enum. /// - `TrackingStatusCode`: The EPXRBodyTrackingStatusCode enum. /// - `TrackingErrorCode`: The EPXRBodyTrackingErrorCode enum. /// - `Connected Band Count`: Connected count of bands. /// - `Connected Fitness Band`: Array of connected bands. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|BodyTracking") static bool PXR_GetBodyTrackingState(bool& IsTracking, FPXRBodyTrackingState& TrackingState); /// /// Starts body tracking. /// /// Passes the information for starting body tracking. /// - `Body Tracking Mode`: The EBodyTrackingMode enum. /// - `Bone Length`: Specifies bone length. /// - `Other Mode`: The default value is `-1`, it is reserved for special requirements. Currently, you do not need to pass anything. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|BodyTracking") static bool PXR_StartBodyTracking(const FPXRBodyTrackingStartInfo& StartInfo); /// /// Stops body tracking. /// /// Passes the information for stopping body tracking. Currently, you do not need to pass anything. /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|BodyTracking") static bool PXR_StopBodyTracking(const FPXRBodyTrackingStopInfo& StopInfo); /// Gets body tracking data. /// /// Float. Specifies how many Unreal units correspond to one meter in the real world. 100 by default. /// Specifies the body tracking data you want: /// - DisplayTime: Int. Set as the prediction time. If DisplayTime is set to 0, the prediction time of the current frame will be used as DisplayTime. /// - DataFlags: The EPXRBodyTrackingGetDataFlags enum. /// /// Returns the desired body tracking data. The structure containing the following details: /// /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|BodyTracking", meta = (WorldToMetersScale = "100.0")) static bool PXR_GetBodyTrackingData(float WorldToMetersScale, const FPXRBodyTrackingDataGetInfo& GetInfo, FPXRBodyTrackingData& BodyTrackingData); /// Starts motion tracker calibration app. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|BodyTracking") static bool PXR_StartMotionTrackerCalibApp(); /// Gets the connect state of motion tracker. /// /// Connect state of the motion tracker, which includes: /// - `Tracker Sum`: The count of trackers. /// - `Trackers SN Array`: The array of trackers' SN. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker") static bool PXR_GetMotionTrackerConnectStateWithSN(FPXRMotionConnectState& connectState); /// Gets the device type of motion tracker. /// /// Device type of the motion tracker, which includes: /// - `PICO MOTION TRACKER 1.0`: Motion Tracker 1.0. /// - `PICO MOTION TRACKER 2.0`: Motion Tracker 2.0. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker") static bool PXR_GetMotionTrackerDeviceType(EPXRMotionTrackerType& trackerType); /// Gets the mode of motion tracker. /// /// Mode of the motion tracker, which includes: /// - `BODY TRACKING MODE`: Body tracking mode. /// - `OBJECT TRACKING MODE`: Object tracking mode. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker") static bool PXR_GetMotionTrackerMode(EPXRMotionTrackerMode& trackerMode); /// Gets the location of motion tracker. /// /// Float. Specifies how many Unreal units correspond to one meter in the real world. 100 by default. /// The array of trackers' SN. /// SN location data, which includes: /// - TrackerSN: Int. SN of the Tracker corresponding to the data. /// - Local Pose: Same frame pose as HMD. /// - Global Pose: Pose in the global reference frame of the system. It is not recommended to use without special requirements. /// /// The EPXRMotionTrackerConfidence enum: /// - `PXR_STATIC_ACCURATE = 0 UMETA`: Static, accurate tracking. /// - `PXR_6DOF_ACCURATE = 1 UMETA`: 6DoF data, tracking accurate. /// - `PXR_3DOF_NOT_ACCURATE = 2 UMETA`: 3DoF data, tracking is not accurate. /// - `PXR_6DOF_NOT_ACCURATE = 3 UMETA`: 6DoF data, tracking is not accurate. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker", meta = (WorldToMetersScale = "100.0")) static bool PXR_GetMotionTrackerLocations(float WorldToMetersScale ,const FString& trackerSN, FPXRMotionTrackerLocations& locations,EPXRMotionTrackerConfidence& Confidence); /// Checks the mode and number of motion tracker. /// /// Desired tracking mode: /// - `BODY TRACKING MODE`: Body tracking mode. /// - `OBJECT TRACKING MODE`: Object tracking mode. /// /// Desired number of tracker, value range:[0,3]. /// UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker") static void PXR_CheckMotionTrackerModeAndNumber(EPXRMotionTrackerMode trackerType,int32 TrackerNumber); /// Gets the connect state of externally developed trackers. /// /// The connect state of externally developed trackers, which includes: /// - `Ext Number`: Connected number of externally developed trackers. /// - `ExDevTrackerInfos`: Infomation on externally developed trackers, which includes: /// - `Tracker SN`: SN of externally developed trackers. /// - `Charger Status`: The charger status, `0` represents in charging, `1` reresents not in charging. /// - `Battery Volume`: Battery volume of externally developed trackers, value range:[0,10]. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker") static bool PXR_GetExtDevTrackerConnectState(FPXRExtDevTrackerConnectState &connectState); /// Sets the viberation of externally developed trackers. /// /// Spread spectrum vibration, the parameter includes: /// - `Tracker SN`: SN of externally developed trackers. /// - `Level`: Motor vibration intensity, stop vibrating if the value is `0`,value range:[0,255]. /// - `Frequency`: Motor viberation frequency, value range:(40,500). /// - `Duration`: Motor vibration time, unit ms, when the value is `-999`, it means that the vibration is constant. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker") static bool PXR_SetExtDevTrackerMotorVibrate(const FPXRExtDevTrackerMotorVibrate &motorVibrate); /// Sets the pass data state of externally developed trackers. /// /// Bool: ///
    ///
  • `true`: enable the pass data
  • ///
  • `false`: pass data closed
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker") static bool PXR_SetExtDevTrackerPassDataState(bool State); /// Sets the externally developed trackers by pass data. /// /// Array of pass data, includes: /// - `Tracker SN`: SN of externally developed trackers. /// - `PassData`: Currently valid pass data array. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker") static bool PXR_SetExtDevTrackerByPassData(const FPXRExtDevTrackerPassData &passData); /// Gets the externally developed trackers by pass data. /// /// Array of pass data, includes: /// - `Tracker SN`: SN of externally developed trackers. /// - `PassData`: Currently valid pass data array. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker") static bool PXR_GetExtDevTrackerByPassData(TArray &PassDatas); /// Gets the externally developed trackers' battery. /// /// SN of externally developed trackers. /// Battery of externally developed trackers, value range: [0-10] /// Whether the tracker is on charging, `0` for not on charging, `1` for on charging. /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker") static bool PXR_GetExtDevTrackerBattery(const FString& trackerSN,int32& out_battery,int32& out_charger); /// Gets the key data of externally developed trackers. /// /// SN of externally developed trackers. /// Key data of the trackers including: /// - `Ext Dev ID`: ID of the externally developed tracker. /// - `key`: `0` for not pressed, `1` for pressed. /// - `touch`: `0` for not pressed, `1` for pressed. /// - `Trigger`: Value range:[0,255]. /// - `Grip`: Value range:[0,255]. /// - `Rocker_x`: Value range:[0,255]. /// - `TRocker_y`: Value range:[0,255]. /// /// Bool: ///
    ///
  • `true`: success
  • ///
  • `false`: failure
  • ///
UFUNCTION(BlueprintCallable, Category = "PXR|MotionTracker") static bool PXR_GetExtDevTrackerKeyData(const FString& trackerSN, FPXRExtDevTrackerKeyData &keyData); };