PICO Unity XR SDK
|
Static Public Member Functions | |
static Controller | GetDominantHand () |
Gets the current dominant controller. More... | |
static void | SetDominantHand (Controller controller) |
Sets a controller as the dominant controller. More... | |
static void | SetControllerVibration (float strength, int time, Controller controller) |
Sets controller vibration, including vibration amplitude and duration. More... | |
static ControllerDevice | GetControllerDeviceType () |
Gets the device model. More... | |
static bool | IsControllerConnected (Controller controller) |
Gets the connection status for a specified controller. More... | |
static void | SetControllerOriginOffset (Controller controller, Vector3 offset) |
Sets the offset of the controller's display position to its real position. More... | |
static Quaternion | GetControllerPredictRotation (Controller controller, double predictTime) |
Gets the predicted orientation of a specified controller after a specified time. More... | |
static Vector3 | GetControllerPredictPosition (Controller controller, double predictTime) |
Gets the predicted position of a specified controller after a specified time. More... | |
static int | SetControllerVibrationEvent (UInt32 hand, int frequency, float strength, int time) |
Sets event-triggered vibration for a specified controller. More... | |
static int | StopControllerVCMotor (int sourceId) |
Stops audio-triggered vibration. More... | |
static int | StartControllerVCMotor (string file, VibrateController vibrateController) |
Starts audio-triggered vibration for specified controller(s). The audio data come from an audio file. More... | |
static int | SetControllerAmp (float mode) |
Sets the amplitude for audio-triggered vibration. Support changing the vibration amplitude during audio playback. More... | |
static int | StartVibrateBySharem (AudioClip audioClip, VibrateController vibrateController, ChannelFlip channelFlip, ref int sourceId) |
Starts audio-triggered vibration for specified controller(s). The audio data come from an audio clip passed to the Unity Engine. More... | |
static int | StartVibrateBySharem (float[] data, VibrateController vibrateController, int buffersize, int frequency, int channelMask, ChannelFlip channelFlip, ref int sourceId) |
Starts audio-triggered vibration for specified controller(s). This function is the overloaded version. More... | |
static int | SaveVibrateByCache (AudioClip audioClip, VibrateController vibrateController, ChannelFlip channelFlip, CacheConfig cacheConfig, ref int sourceId) |
Caches audio-triggered vibration data for specified controller(s). More... | |
static int | SaveVibrateByCache (float[] data, VibrateController vibrateController, int buffersize, int frequency, int channelMask, ChannelFlip channelFlip, CacheConfig cacheConfig, ref int sourceId) |
Caches audio-triggered vibration data for specified controller(s). This function is the overloaded version. More... | |
static int | StartVibrateByCache (int sourceId) |
Plays cached audio-triggered vibration data. More... | |
static int | ClearVibrateByCache (int sourceId) |
Clears cached audio-triggered vibration data. More... | |
static int | SetControllerEnableKey (bool isEnable, PxrControllerKeyMap Key) |
static int | StartVibrateByPHF (TextAsset phfText, ref int sourceId, VibrateController vibrateController, ChannelFlip channelFlip, float amp) |
Starts PHF-triggered vibration for specified controller(s). PHF stands for PICO haptic file. More... | |
static int | PauseVibrate (int sourceId) |
Pauses PHF-triggered vibration. More... | |
static int | ResumeVibrate (int sourceId) |
Resumes PHF-triggered vibration. More... | |
static int | UpdateVibrateParams (int sourceId, VibrateController vibrateController, ChannelFlip channelFlip, float amp) |
Dynamically updates PHF and AudioClip vibration data. More... | |
static void | SendHapticImpulse (VibrateType vibrateType, float amplitude, int duration, int frequency=150) |
Sends a haptic impulse to specified controller(s) to trigger vibration. More... | |
static int | SendHapticBuffer (VibrateType vibrateType, AudioClip audioClip, ChannelFlip channelFlip, ref int sourceId, CacheType cacheType=CacheType.DontCache) |
static int | SendHapticBuffer (VibrateType vibrateType, float[] pcmData, int buffersize, int frequency, int channelMask, ChannelFlip channelFlip, ref int sourceId, CacheType cacheType=CacheType.DontCache) |
static int | SendHapticBuffer (VibrateType vibrateType, TextAsset phfText, ChannelFlip channelFlip, float amplitudeScale, ref int sourceId) |
Sends a buffer of haptic data to specified controller(s) to trigger vibration. More... | |
static int | StopHapticBuffer (int sourceId=0, bool clearCache=false) |
Stops a specified buffered haptic. More... | |
static int | PauseHapticBuffer (int sourceId) |
Pauses a specified buffered haptic. More... | |
static int | ResumeHapticBuffer (int sourceId) |
Resumes a paused buffered haptic. More... | |
static int | StartHapticBuffer (int sourceId) |
Starts a specified buffered haptic. More... | |
static int | UpdateHapticBuffer (int sourceId, VibrateType vibrateType, ChannelFlip channelFlip, float amplitudeScale) |
Updates the settings for a specified buffered haptic. More... | |
static int | CreateHapticStream (string phfVersion, UInt32 frameDurationMs, ref VibrateInfo hapticInfo, float speed, ref int id) |
Creates a haptic stream. More... | |
static int | WriteHapticStream (int id, ref PxrPhfParamsNum frames, UInt32 numFrames) |
Writes haptic data to a specified stream. More... | |
static int | SetHapticStreamSpeed (int id, float speed) |
Sets a transmission speed for a specified haptic stream. More... | |
static int | GetHapticStreamSpeed (int id, ref float speed) |
Gets the transmission speed of a specified haptic stream. More... | |
static int | GetHapticStreamCurrentFrameSequence (int id, ref UInt64 frameSequence) |
Gets the No. of the frame that the controller currently plays. More... | |
static int | StartHappticStream (int source_id) |
Starts the transmission of a specified haptic stream. More... | |
static int | StopHappticStream (int source_id) |
Stops the transmission of a specified haptic stream. More... | |
static int | RemoveHappticStream (int source_id) |
Removes a specified haptic stream. More... | |
static PxrPhfFile | AnalysisHappticStreamPHF (TextAsset phfText) |
Parses the haptic data in a specified PICO haptic file (PHF). More... | |
static void | ResetController () |
Recenters the controller on PICO G3. | |
static void | SetArmModelParameters (PxrGazeType gazetype, PxrArmModelType armmodeltype, float elbowHeight, float elbowDepth, float pointerTiltAngle) |
Sets arm model parameters on PICO G3. More... | |
static void | GetControllerHandness (ref int deviceID) |
Gets the current user's dominant hand in the system on PICO G3. More... | |
|
static |
Gets the current dominant controller.
LeftController
; RightController
.
|
static |
Sets a controller as the dominant controller.
controller | The controller to be set as the dominant controller: 0 -left controller; 1 -right controller. |
|
static |
Sets controller vibration, including vibration amplitude and duration.
SendHapticImpulse
method offered by UnityXR is also supported. Click here for more information. strength | Vibration amplitude. The valid value ranges from 0 to 1 . The greater the value, the stronger the vibration amplitude. To stop controller vibration, call this function again and set this parameter to 0 . |
time | Vibration duration. The valid value ranges from 0 to 65535 ms. |
controller | The controller to set vibration for:
|
|
static |
Gets the device model.
G2
, Neo2
, Neo3
, NewController
, PICO_4
.
|
static |
Gets the connection status for a specified controller.
controller | The controller to get connection status for:
|
true
: connectedfalse
: not connected
|
static |
Sets the offset of the controller's display position to its real position.
hand | The controller to set an offset for:
|
offset | The offset (in meters). |
|
static |
Gets the predicted orientation of a specified controller after a specified time.
hand | The controller to get the predicted rotation for:
|
predictTime | The time for prediction (in milliseconds). |
|
static |
Gets the predicted position of a specified controller after a specified time.
hand | The controller to get the predicted position for:
|
predictTime | The time for prediction (in milliseconds). |
|
static |
Sets event-triggered vibration for a specified controller.
hand | The controller to enable vibration for:
|
frequency | Vibration frequency, which ranges from 50 to 500 Hz. |
strength | Vibration amplitude. Its valid value ranges from 0 to 1 . The higher the value, the stronger the vibration amplitude. |
time | Vibration duration, which ranges from 0 to 65535 ms. |
|
static |
Stops audio-triggered vibration.
id | A reserved parameter, set it to the source ID returned by StartVibrateBySharem or SaveVibrateByCache to stop the corresponding vibration, or set it to 0 to stop all vibrations. |
|
static |
Starts audio-triggered vibration for specified controller(s). The audio data come from an audio file.
file | The path to the audio file. |
vibrateController | The controller(s) to enable vibration for:
|
|
static |
Sets the amplitude for audio-triggered vibration. Support changing the vibration amplitude during audio playback.
mode | Vibration amplitude level:
|
"3×standard amplitude" and "4×standard amplitude" are NOT recommended as they will cause serious loss of vibration details.
|
static |
Starts audio-triggered vibration for specified controller(s). The audio data come from an audio clip passed to the Unity Engine.
audioClip | The path to the audio clip. |
vibrateController | The controller(s) to enable vibration for:
|
Whether to enable audio channel inversion:
Yes
: enableNo
: disable Once audio channel inversion is enabled, the left controller vibrates with the audio data from the right channel, and vice versa. Returns the unique ID for controlling the corresponding vibration, which will be used in StartVibrateByCache
, ClearVibrateByCache
or StopControllerVCMotor
.
|
static |
Starts audio-triggered vibration for specified controller(s). This function is the overloaded version.
data | The PCM data. |
vibrateController | The controller(s) to enable vibration for:
|
buffersize | The length of PCM data. Formula: (audioClip.samples)×(audioClip.channels). |
frequency | Audio sampling rate. |
channelMask | The number of channels. |
channelFlip | Whether to enable audio channel inversion:
|
sourceId | Returns the unique ID for controlling the corresponding vibration, which will be used in StartVibrateByCache , ClearVibrateByCache or StopControllerVCMotor . |
|
static |
Caches audio-triggered vibration data for specified controller(s).
audioClip | The path to the audio clip. |
vibrateController | The controller(s) to cache data for:
|
channelFlip | Whether to enable audio channel inversion:
|
cacheConfig | Whether to keep the controller vibrating while caching audio-based vibration data:
|
sourceId | Returns the unique ID for controlling the corresponding vibration, which will be used in StartVibrateByCache , ClearVibrateByCache or StopControllerVCMotor . |
0
: success-1
: failure
|
static |
Caches audio-triggered vibration data for specified controller(s). This function is the overloaded version.
data | The PCM data. |
vibrateController | The controller(s) to cache data for:
|
buffersize | The length of PCM data. Formula: (audioClip.samples)×(audioClip.channels) |
frequency | Audio sampling rate. |
channelMask | The number of channels. |
channelFlip | Whether to enable audio channel inversion:
|
cacheConfig | Whether to keep the controller vibrating while caching audio-based vibration data:
|
sourceId | Returns the unique ID for controlling the corresponding vibration, which will be used in StartVibrateByCache , ClearVibrateByCache or StopControllerVCMotor . |
0
: success-1
: failure
|
static |
Plays cached audio-triggered vibration data.
sourceId | The source ID returned by StartVibrateBySharem or SaveVibrateByCache . |
0
: success-1
: failure
|
static |
Clears cached audio-triggered vibration data.
sourceId | The source ID returned by StartVibrateBySharem or SaveVibrateByCache . |
0
: success-1
: failure
|
static |
Starts PHF-triggered vibration for specified controller(s). PHF stands for PICO haptic file.
phfText | The path to the PHF file. |
sourceId | The source ID returned by StartVibrateBySharem or SaveVibrateByCache . |
vibrateController | The controller(s) to enable vibration for:
|
channelFlip | Whether to enable audio channel inversion:
|
amp | The vibration gain, the valid value range from 0 to 2 :
|
0
: success-1
: failure
|
static |
Pauses PHF-triggered vibration.
sourceId | The source ID returned by StartVibrateBySharem or SaveVibrateByCache . |
0
: success-1
: failure
|
static |
Resumes PHF-triggered vibration.
sourceId | The source ID returned by StartVibrateBySharem or SaveVibrateByCache . |
0
: success-1
: failure
|
static |
Dynamically updates PHF and AudioClip vibration data.
sourceId | The source ID returned by StartVibrateBySharem or SaveVibrateByCache . |
vibrateController | The controller(s) to update PHF and AudioClip vibration data for:
|
channelFlip | Whether to enable audio channel inversion:
|
amp | The vibration gain, the valid value range from 0 to 2 :
|
0
: success-1
: failure
|
static |
Sends a haptic impulse to specified controller(s) to trigger vibration.
amplitude
and duration
to 0
. vibrateType | The controller(s) to send the haptic impulse to:
|
amplitude | Vibration amplitude, which ranges from 0 to 1 . The higher the value, the stronger the vibration amplitude. |
duration | Vibration duration, which ranges from 0 to 65535 ms. |
frequency | Vibration frequency, which ranges from 50 to 500 Hz. |
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
vibrateType | The controller(s) to send the haptic data to:
|
audioClip | The audio data pulled from the audio file stored in the AudioClip component is used as the haptic data. |
channelFlip | Determines whether to enable audio channel inversion. Once enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
|
sourceId | Returns the unique ID for controlling the corresponding buffered haptic, which will be used in PauseHapticBuffer , ResumeHapticBuffer , UpdateHapticBuffer , or StopHapticBuffer . |
cacheType | Whether to keep the controller vibrating while caching haptic data:
|
If not defined, DontCache
will be passed by default.
0
: success1
: failure
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
vibrateType | The controller(s) to send the haptic data to:
|
pcmData | The PCM data is converted from the audio file stored in the AudioClip component in the Unity Engine. |
buffersize | The length of PCM data. Calculation formula: (audioClip.samples)×(audioClip.channels). Sample refers to the data in each channel. |
frequency | Sample rate. The higher the sample rate, the closer the recorded signal is to the original. |
channelMask | The number of channels that play the haptic data. |
channelFlip | Determines whether to enable audio channel inversion. Once enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
|
sourceId | Returns the unique ID for controlling the corresponding buffered haptic, which will be used in PauseHapticBuffer , ResumeHapticBuffer , UpdateHapticBuffer , or StopHapticBuffer . |
cacheType | Whether to keep the controller vibrating while caching haptic data:
|
If not defined, DontCache
will be passed by default.
0
: success-1
: failure
|
static |
Sends a buffer of haptic data to specified controller(s) to trigger vibration.
vibrateType | The controller(s) to send the haptic data to:
| ||
phfText | The PHF file (.json) that contains haptic data. | ||
channelFlip | Determines whether to enable audio channel inversion. Once enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
| ||
sourceId | Returns the unique ID for controlling the corresponding buffered haptic, which will be used in PauseHapticBuffer , ResumeHapticBuffer , UpdateHapticBuffer , or StopHapticBuffer . |
0
: success-1
: failure
|
static |
Stops a specified buffered haptic.
sourceId | The source ID returned by SendHapticBuffer . Set it to the target source ID to stop a specific buffered haptic, or set it to 0 to stop all buffered haptics. If not defined, 0 will be passed to stop all buffered haptics by default. |
clearCache | Determines whether to clear the cached data of the specified haptic. If not defined, false will be passed to keep the cached data by default. |
0
: success1
: failure
|
static |
Pauses a specified buffered haptic.
sourceId | The source ID returned by SendHapticBuffer . Set it to the target source ID to stop a specific buffered haptic. |
0
: success-1
: failure
|
static |
Resumes a paused buffered haptic.
sourceId | The source ID returned by SendHapticBuffer . Set it to the target source ID to resume a specific buffered haptic. |
0
: success-1
: failure
|
static |
Starts a specified buffered haptic.
CacheNoVibrate
in SendHapticBuffer
, call this API if you want to start haptic after caching the data. sourceId | The source ID returned by SendHapticBuffer when there is cached data for the haptic. |
0
: success-1
: failure
|
static |
Updates the settings for a specified buffered haptic.
sourceId | The source ID returned by SendHapticBuffer . Set it to the target source ID to update a specific buffered haptic. | ||
vibrateType | The controller(s) that the vibration is applied to:
| ||
channelFlip | Determines whether to enable audio channel inversion. Once enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
|
0
: success-1
: failure
|
static |
Creates a haptic stream.
phfVersion | The version of the PICO haptic file (PHF) that the stream uses. |
frameDurationMs | Interframe space, which is the amount of time in milliseconds existing between the transmissions of frames. |
hapticInfo | The information about this haptic stream you create. |
speed | The streaming speed. |
id | Returns the ID of the stream. |
0
: success1
: failure
|
static |
Writes haptic data to a specified stream.
id | The ID of the target stream. |
frames | The data contained in the PICO haptic file (PHF). |
numFrames | The number of frames. |
0
: success1
: failure
|
static |
Sets a transmission speed for a specified haptic stream.
id | The ID of the stream. |
speed | The transmission speed to set for the stream. |
0
: success1
: failure
|
static |
Gets the transmission speed of a specified haptic stream.
id | The ID of the stream. |
speed | Returns the stream's transmission speed. |
0
: success1
: failure
|
static |
Gets the No. of the frame that the controller currently plays.
id | The ID of the haptic stream that triggers the vibration. |
frameSequence | Returns the current frame's sequence No. |
0
: success1
: failure
|
static |
Starts the transmission of a specified haptic stream.
source_id | The ID of the haptic stream. |
0
: success1
: failure
|
static |
Stops the transmission of a specified haptic stream.
source_id | The ID of the haptic stream. |
0
: success1
: failure
|
static |
Removes a specified haptic stream.
source_id | The ID of the stream. |
0
: success1
: failure
|
static |
Parses the haptic data in a specified PICO haptic file (PHF).
phfText | The PICO haptic file (.json) to parse. |
|
static |
Sets arm model parameters on PICO G3.
gazetype | Gaze type, which is used to define the way of getting the HMD data. |
armmodeltype | Arm model type |
elbowHeight | The elbow's height, which changes the arm's length.Value range: (0.0f, 0.2f). The default value is 0.0f. |
elbowDepth | The elbow's depth, which changes the arm's position.Value range: (0.0f, 0.2f). The default value is 0.0f. |
pointerTiltAngle | The ray's tilt angle. Value range: (0.0f, 30.0f). The default value is 0.0f. |
|
static |
Gets the current user's dominant hand in the system on PICO G3.
deviceID |