PICO Unity XR SDK
|
Public Types | |
enum | ControllerDevice { G2 = 3 , Neo2 , Neo3 , PICO_4 , NewController = 10 } |
enum | Controller { LeftController , RightController } |
enum | VibrateController { No = 0 , Left = 1 , Right = 2 , LeftAndRight = 3 } |
enum | ChannelFlip { No , Yes } |
enum | CacheConfig { CacheAndVibrate = 1 , CacheNoVibrate = 2 } |
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 controller's connection status. 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 rotation 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-based vibration. More... | |
static int | StopControllerVCMotor (int sourceId) |
Stops sound vibration. More... | |
static int | StartControllerVCMotor (string file, VibrateController vibrateController) |
Starts sound vibration through an audio file. More... | |
static int | SetControllerAmp (float mode) |
Sets the amplitude for sound vibrations. Support changing the vibration amplitude during audio playback. More... | |
static int | StartVibrateBySharem (AudioClip audioClip, VibrateController vibrateController, ChannelFlip channelFlip, ref int sourceId) |
Starts sound vibration through 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 sound vibration. This function is the overloaded version. More... | |
static int | SaveVibrateByCache (AudioClip audioClip, VibrateController vibrateController, ChannelFlip channelFlip, CacheConfig cacheConfig, ref int sourceId) |
Caches sound vibration data. More... | |
static int | SaveVibrateByCache (float[] data, VibrateController vibrateController, int buffersize, int frequency, int channelMask, ChannelFlip channelFlip, CacheConfig cacheConfig, ref int sourceId) |
Caches sound vibration data. This function is the overloaded version. More... | |
static int | StartVibrateByCache (int sourceId) |
Plays cached sound vibration data. More... | |
static int | ClearVibrateByCache (int sourceId) |
Clears cached sound 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 vibration. More... | |
static int | PauseVibrate (int sourceId) |
Pauses PHF vibration. More... | |
static int | ResumeVibrate (int sourceId) |
Resumes PHF vibration. More... | |
static int | UpdateVibrateParams (int sourceId, VibrateController vibrateController, ChannelFlip channelFlip, float amp) |
Dynamically updates PHF and AudioClip vibration data. More... | |
enum CacheConfig |
enum ChannelFlip |
enum Controller |
enum ControllerDevice |
enum VibrateController |
|
static |
Clears cached sound vibration data.
sourceId | The source ID returned by StartVibrateBySharem or SaveVibrateByCache . |
0
: success-1
: failure
|
static |
Gets the device model.
G2
, Neo2
, Neo3
, NewController
.
|
static |
Gets the predicted position of a specified controller after a specified time.
hand | The controller to get the predicted position for: 0 -left controller; 1 -right controller. |
predictTime | The time for prediction (in milliseconds). |
|
static |
Gets the predicted rotation of a specified controller after a specified time.
hand | The controller to get the predicted rotation for: 0 -left controller; 1 -right controller. |
predictTime | The time for prediction (in milliseconds). |
|
static |
Gets the current dominant controller.
LeftController
; RightController
.
|
static |
Gets controller's connection status.
controller | The controller to get the connection status for: 0 -left controller; 1 -right controller. |
true
-connected; false
-not connected.
|
static |
Pauses PHF vibration.
sourceId | The source ID returned by StartVibrateBySharem or SaveVibrateByCache . |
0
: success-1
: failure
|
static |
Resumes PHF vibration.
sourceId | The source ID returned by StartVibrateBySharem or SaveVibrateByCache . |
0
: success-1
: failure
|
static |
Caches sound vibration data.
audioClip | The audio clip file. |
vibrateController | The controller(s) to cache sound vibration 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 sound vibration data. This function is the overloaded version.
data | The PCM data. |
vibrateController | The controller(s) to cache sound vibration 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 |
Sets the amplitude for sound vibrations. 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 |
|
static |
Sets the offset of the controller's display position to its real position.
hand | The controller to set an offset for: 0 -left controller; 1 -right controller. |
offset | The offset (in meters). |
|
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 |
Sets event-based vibration.
hand | The controller to enable event-based 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 |
Sets a controller as the dominant controller.
controller | The controller to be set as the dominant controller: 0 -left controller; 1 -right controller. |
|
static |
Starts sound vibration through an audio file.
file | The file path that the audio data comes from. |
vibrateController | The controller(s) to enable sound vibration for:
|
|
static |
Plays cached sound vibration data.
sourceId | The source ID returned by StartVibrateBySharem or SaveVibrateByCache . |
0
: success-1
: failure
|
static |
Starts PHF vibration.
phfText | The PHF file. |
sourceId | The source ID returned by StartVibrateBySharem or SaveVibrateByCache . |
vibrateController | The controller(s) to enable PHF 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 |
Starts sound vibration through an audio clip passed to the Unity Engine.
audioClip | The audio clip file. |
vibrateController | The controller(s) to enable sound 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 sound vibration. This function is the overloaded version.
data | The PCM data. |
vibrateController | The controller(s) to enable sound 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 |
Stops sound 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 |
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