PICO Unity XR SDK
PXR_Input Class Reference

Public Types

enum  ControllerDevice {
  G2 = 3 , Neo2 , Neo3 , PICO_4 ,
  Merline , NewController = 10
}
 
enum  Controller { LeftController , RightController }
 
enum  VibrateController { No = 0 , Left = 1 , Right = 2 , LeftAndRight = 3 }
 
enum  VibrateType { None = 0 , LeftController = 1 , RightController = 2 , BothController = 3 }
 
enum  CacheType { DontCache = 0 , CacheAndVibrate = 1 , CacheNoVibrate = 2 }
 
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 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...
 

Member Function Documentation

◆ GetDominantHand()

static Controller GetDominantHand ( )
static

Gets the current dominant controller.

Returns
The current dominant controller: LeftController; RightController.

◆ SetDominantHand()

static void SetDominantHand ( Controller  controller)
static

Sets a controller as the dominant controller.

Parameters
controllerThe controller to be set as the dominant controller: 0-left controller; 1-right controller.

◆ SetControllerVibration()

static void SetControllerVibration ( float  strength,
int  time,
Controller  controller 
)
static

Sets controller vibration, including vibration amplitude and duration.

Note
The SendHapticImpulse method offered by UnityXR is also supported. Click here for more information.
Parameters
strengthVibration 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.
timeVibration duration. The valid value ranges from 0 to 65535 ms.
controllerThe controller to set vibration for:
  • 0: left controller
  • 1: right controller

◆ GetControllerDeviceType()

static ControllerDevice GetControllerDeviceType ( )
static

Gets the device model.

Returns
The device model. Enumerations: G2, Neo2, Neo3, NewController, PICO_4.


◆ IsControllerConnected()

static bool IsControllerConnected ( Controller  controller)
static

Gets the connection status for a specified controller.

Parameters
controllerThe controller to get connection status for:
  • 0: left controller
  • 1: right controller
Returns
The connection status of the specified controller:
  • true: connected
  • false: not connected

◆ SetControllerOriginOffset()

static void SetControllerOriginOffset ( Controller  controller,
Vector3  offset 
)
static

Sets the offset of the controller's display position to its real position.

Parameters
handThe controller to set an offset for:
  • 0: left controller
  • 1: right controller
offsetThe offset (in meters).

◆ GetControllerPredictRotation()

static Quaternion GetControllerPredictRotation ( Controller  controller,
double  predictTime 
)
static

Gets the predicted orientation of a specified controller after a specified time.

Parameters
handThe controller to get the predicted rotation for:
  • 0: left controller
  • 1: right controller
predictTimeThe time for prediction (in milliseconds).
Returns
The predicted orientation.

◆ GetControllerPredictPosition()

static Vector3 GetControllerPredictPosition ( Controller  controller,
double  predictTime 
)
static

Gets the predicted position of a specified controller after a specified time.

Parameters
handThe controller to get the predicted position for:
  • 0: left controller
  • 1: right controller
predictTimeThe time for prediction (in milliseconds).
Returns
The predicted position.

◆ SetControllerVibrationEvent()

static int SetControllerVibrationEvent ( UInt32  hand,
int  frequency,
float  strength,
int  time 
)
static

Sets event-triggered vibration for a specified controller.

Deprecated:
Use SendHapticImpulse instead.
Parameters
handThe controller to enable vibration for:
  • 0: left controller
  • 1: right controller
frequencyVibration frequency, which ranges from 50 to 500 Hz.
strengthVibration amplitude. Its valid value ranges from 0 to 1. The higher the value, the stronger the vibration amplitude.
timeVibration duration, which ranges from 0 to 65535 ms.

◆ StopControllerVCMotor()

static int StopControllerVCMotor ( int  sourceId)
static

Stops audio-triggered vibration.

Deprecated:
Use StopHapticBuffer(int sourceId, bool clearCache) instead.
Parameters
idA 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.

◆ StartControllerVCMotor()

static int StartControllerVCMotor ( string  file,
VibrateController  vibrateController 
)
static

Starts audio-triggered vibration for specified controller(s). The audio data come from an audio file.

Deprecated:
Deprecated.
Parameters
fileThe path to the audio file.
vibrateControllerThe controller(s) to enable vibration for:
  • 0: none
  • 1: left controller
  • 2: right controller
  • 3: left and right controllers

◆ SetControllerAmp()

static int SetControllerAmp ( float  mode)
static

Sets the amplitude for audio-triggered vibration. Support changing the vibration amplitude during audio playback.

Deprecated:
Deprecated.
Parameters
modeVibration amplitude level:
  • 0: no vibration
  • 1: standard amplitude
  • 2: 2×standard amplitude
  • 3: 3×standard amplitude
  • 4: 4×standard amplitude

"3×standard amplitude" and "4×standard amplitude" are NOT recommended as they will cause serious loss of vibration details.

◆ StartVibrateBySharem() [1/2]

static int StartVibrateBySharem ( AudioClip  audioClip,
VibrateController  vibrateController,
ChannelFlip  channelFlip,
ref int  sourceId 
)
static

Starts audio-triggered vibration for specified controller(s). The audio data come from an audio clip passed to the Unity Engine.

Deprecated:
Use SendHapticBuffer(VibrateType vibrateType, AudioClip audioClip, ChannelFlip channelFlip, ref int sourceId, CacheType cacheType) instead.
Parameters
audioClipThe path to the audio clip.
vibrateControllerThe controller(s) to enable vibration for:
  • 0: none
  • 1: left controller
  • 2: right controller
  • 3: left and right controllers

Whether to enable audio channel inversion:

  • Yes: enable
  • No: 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.

◆ StartVibrateBySharem() [2/2]

static int StartVibrateBySharem ( float[]  data,
VibrateController  vibrateController,
int  buffersize,
int  frequency,
int  channelMask,
ChannelFlip  channelFlip,
ref int  sourceId 
)
static

Starts audio-triggered vibration for specified controller(s). This function is the overloaded version.

Deprecated:
Use SendHapticBuffer(VibrateType vibrateType, float[] pcmData, int buffersize, int frequency, int channelMask, ChannelFlip channelFlip, ref int sourceId, CacheType cacheType) instead.
Parameters
dataThe PCM data.
vibrateControllerThe controller(s) to enable vibration for:
  • 0: none
  • 1: left controller
  • 2: right controller
  • 3: left and right controllers
buffersizeThe length of PCM data. Formula: (audioClip.samples)×(audioClip.channels).
frequencyAudio sampling rate.
channelMaskThe number of channels.
channelFlipWhether to enable audio channel inversion:
  • Yes: enable
  • No: disable Once audio channel inversion is enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
sourceIdReturns the unique ID for controlling the corresponding vibration, which will be used in StartVibrateByCache, ClearVibrateByCache or StopControllerVCMotor.

◆ SaveVibrateByCache() [1/2]

static int SaveVibrateByCache ( AudioClip  audioClip,
VibrateController  vibrateController,
ChannelFlip  channelFlip,
CacheConfig  cacheConfig,
ref int  sourceId 
)
static

Caches audio-triggered vibration data for specified controller(s).

Deprecated:
Use SendHapticBuffer(VibrateType vibrateType, AudioClip audioClip, ChannelFlip channelFlip, ref int sourceId, CacheType cacheType) instead.
Note
The cached data can be extracted from the cache directory and then transmitted, which reduces resource consumption and improves service performance.
Parameters
audioClipThe path to the audio clip.
vibrateControllerThe controller(s) to cache data for:
  • 0: none
  • 1: left controller
  • 2: right controller
  • 3: left and right controllers
channelFlipWhether to enable audio channel inversion:
  • Yes: enable
  • No: disable Once audio channel inversion is enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
cacheConfigWhether to keep the controller vibrating while caching audio-based vibration data:
  • CacheAndVibrate: cache and keep vibrating
  • CacheNoVibrate: cache and stop vibrating
sourceIdReturns the unique ID for controlling the corresponding vibration, which will be used in StartVibrateByCache, ClearVibrateByCache or StopControllerVCMotor.
Returns
  • 0: success
  • -1: failure

◆ SaveVibrateByCache() [2/2]

static int SaveVibrateByCache ( float[]  data,
VibrateController  vibrateController,
int  buffersize,
int  frequency,
int  channelMask,
ChannelFlip  channelFlip,
CacheConfig  cacheConfig,
ref int  sourceId 
)
static

Caches audio-triggered vibration data for specified controller(s). This function is the overloaded version.

Deprecated:
Use SendHapticBuffer(VibrateType vibrateType, float[] pcmData, int buffersize, int frequency, int channelMask, ChannelFlip channelFlip, ref int sourceId, CacheType cacheType)
Note
The cached data can be extracted from the cache directory and then transmitted, which reduces resource consumption and improves service performance.
Parameters
dataThe PCM data.
vibrateControllerThe controller(s) to cache data for:
  • 0: none
  • 1: left controller
  • 2: right controller
  • 3: left and right controllers
buffersizeThe length of PCM data. Formula: (audioClip.samples)×(audioClip.channels)
frequencyAudio sampling rate.
channelMaskThe number of channels.
channelFlipWhether to enable audio channel inversion:
  • Yes: enable
  • No: disable Once audio channel inversion is enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
cacheConfigWhether to keep the controller vibrating while caching audio-based vibration data:
  • CacheAndVibrate: cache and keep vibrating
  • CacheNoVibrate: cache and stop vibrating
sourceIdReturns the unique ID for controlling the corresponding vibration, which will be used in StartVibrateByCache, ClearVibrateByCache or StopControllerVCMotor.
Returns
  • 0: success
  • -1: failure

◆ StartVibrateByCache()

static int StartVibrateByCache ( int  sourceId)
static

Plays cached audio-triggered vibration data.

Deprecated:
Use StartHapticBuffer instead.
Parameters
sourceIdThe source ID returned by StartVibrateBySharem or SaveVibrateByCache.
Returns
  • 0: success
  • -1: failure

◆ ClearVibrateByCache()

static int ClearVibrateByCache ( int  sourceId)
static

Clears cached audio-triggered vibration data.

Deprecated:
Use StopHapticBuffer(clearCache) instead.
Parameters
sourceIdThe source ID returned by StartVibrateBySharem or SaveVibrateByCache.
Returns
  • 0: success
  • -1: failure

◆ StartVibrateByPHF()

static int StartVibrateByPHF ( TextAsset  phfText,
ref int  sourceId,
VibrateController  vibrateController,
ChannelFlip  channelFlip,
float  amp 
)
static

Starts PHF-triggered vibration for specified controller(s). PHF stands for PICO haptic file.

Deprecated:
Use SendHapticBuffer(VibrateType vibrateType, TextAsset phfText, ChannelFlip channelFlip, float amplitudeScale, ref int sourceId) instead.
Parameters
phfTextThe path to the PHF file.
sourceIdThe source ID returned by StartVibrateBySharem or SaveVibrateByCache.
vibrateControllerThe controller(s) to enable vibration for:
  • 0: none
  • 1: left controller
  • 2: right controller
  • 3: left and right controllers
channelFlipWhether to enable audio channel inversion:
  • Yes: enable
  • No: disable Once audio channel inversion is enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
ampThe vibration gain, the valid value range from 0 to 2:
  • 0: no vibration
  • 1: standard amplitude
  • 2: 2×standard amplitude
Returns
  • 0: success
  • -1: failure

◆ PauseVibrate()

static int PauseVibrate ( int  sourceId)
static

Pauses PHF-triggered vibration.

Deprecated:
Use PauseHapticBuffer instead.
Parameters
sourceIdThe source ID returned by StartVibrateBySharem or SaveVibrateByCache.
Returns
  • 0: success
  • -1: failure

◆ ResumeVibrate()

static int ResumeVibrate ( int  sourceId)
static

Resumes PHF-triggered vibration.

Deprecated:
Use ResumeHapticBuffer instead.
Parameters
sourceIdThe source ID returned by StartVibrateBySharem or SaveVibrateByCache.
Returns
  • 0: success
  • -1: failure

◆ UpdateVibrateParams()

static int UpdateVibrateParams ( int  sourceId,
VibrateController  vibrateController,
ChannelFlip  channelFlip,
float  amp 
)
static

Dynamically updates PHF and AudioClip vibration data.

Deprecated:
Use UpdateHapticBuffer instead.
Parameters
sourceIdThe source ID returned by StartVibrateBySharem or SaveVibrateByCache.
vibrateControllerThe controller(s) to update PHF and AudioClip vibration data for:
  • 0: none
  • 1: left controller
  • 2: right controller
  • 3: left and right controllers
channelFlipWhether to enable audio channel inversion:
  • Yes: enable
  • No: disable Once audio channel inversion is enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
ampThe vibration gain, the valid value range from 0 to 2:
  • 0: no vibration
  • 1: standard amplitude
  • 2: 2×standard amplitude
Returns
  • 0: success
  • -1: failure

◆ SendHapticImpulse()

static void SendHapticImpulse ( VibrateType  vibrateType,
float  amplitude,
int  duration,
int  frequency = 150 
)
static

Sends a haptic impulse to specified controller(s) to trigger vibration.

Note
To stop vibration, call this API again and set both amplitude and duration to 0.
Parameters
vibrateTypeThe controller(s) to send the haptic impulse to:
  • None
  • LeftController
  • RightController
  • BothController
amplitudeVibration amplitude, which ranges from 0 to 1. The higher the value, the stronger the vibration amplitude.
durationVibration duration, which ranges from 0 to 65535 ms.
frequencyVibration frequency, which ranges from 50 to 500 Hz.

◆ SendHapticBuffer() [1/3]

int SendHapticBuffer ( VibrateType  vibrateType,
AudioClip  audioClip,
ChannelFlip  channelFlip,
ref int  sourceId,
CacheType  cacheType = CacheType.DontCache 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
vibrateTypeThe controller(s) to send the haptic data to:
  • None
  • LeftController
  • RightController
  • BothController
audioClipThe audio data pulled from the audio file stored in the AudioClip component is used as the haptic data.
channelFlipDetermines whether to enable audio channel inversion. Once enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
  • Yes: enable
  • No: disable
sourceIdReturns the unique ID for controlling the corresponding buffered haptic, which will be used in PauseHapticBuffer, ResumeHapticBuffer, UpdateHapticBuffer, or StopHapticBuffer.
cacheTypeWhether to keep the controller vibrating while caching haptic data:
  • DontCache: don't cache.
  • CacheAndVibrate: cache and keep vibrating.
  • CacheNoVibrate: cache and stop vibrating. Call StartHapticBuffer to start haptic after caching the data.

If not defined, DontCache will be passed by default.

Returns
  • 0: success
  • 1: failure

◆ SendHapticBuffer() [2/3]

int SendHapticBuffer ( VibrateType  vibrateType,
float[]  pcmData,
int  buffersize,
int  frequency,
int  channelMask,
ChannelFlip  channelFlip,
ref int  sourceId,
CacheType  cacheType = CacheType.DontCache 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
vibrateTypeThe controller(s) to send the haptic data to:
  • None
  • LeftController
  • RightController
  • BothController
pcmDataThe PCM data is converted from the audio file stored in the AudioClip component in the Unity Engine.
buffersizeThe length of PCM data. Calculation formula: (audioClip.samples)×(audioClip.channels). Sample refers to the data in each channel.
frequencySample rate. The higher the sample rate, the closer the recorded signal is to the original.
channelMaskThe number of channels that play the haptic data.
channelFlipDetermines whether to enable audio channel inversion. Once enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
  • Yes: enable
  • No: disable
sourceIdReturns the unique ID for controlling the corresponding buffered haptic, which will be used in PauseHapticBuffer, ResumeHapticBuffer, UpdateHapticBuffer, or StopHapticBuffer.
cacheTypeWhether to keep the controller vibrating while caching haptic data:
  • DontCache: don't cache.
  • CacheAndVibrate: cache and keep vibrating.
  • CacheNoVibrate: cache and stop vibrating. Call StartHapticBuffer to start vibration after caching the data.

If not defined, DontCache will be passed by default.

Returns
  • 0: success
  • -1: failure

◆ SendHapticBuffer() [3/3]

static int SendHapticBuffer ( VibrateType  vibrateType,
TextAsset  phfText,
ChannelFlip  channelFlip,
float  amplitudeScale,
ref int  sourceId 
)
static

Sends a buffer of haptic data to specified controller(s) to trigger vibration.

Parameters
vibrateTypeThe controller(s) to send the haptic data to:
  • None
  • LeftController
  • RightController
  • BothController
phfTextThe PHF file (.json) that contains haptic data.
channelFlipDetermines whether to enable audio channel inversion. Once enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
  • Yes: enable
  • No: disable
    Parameters
    amplitudeScaleVibration amplitude, the higher the amplitude, the stronger the haptic effect. The valid value range from 0 to 2:
    0: no vibration
  • 1: standard amplitude
  • 2: 2×standard amplitude
sourceIdReturns the unique ID for controlling the corresponding buffered haptic, which will be used in PauseHapticBuffer, ResumeHapticBuffer, UpdateHapticBuffer, or StopHapticBuffer.
Returns
  • 0: success
  • -1: failure

◆ StopHapticBuffer()

static int StopHapticBuffer ( int  sourceId = 0,
bool  clearCache = false 
)
static

Stops a specified buffered haptic.

Parameters
sourceIdThe 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.
clearCacheDetermines whether to clear the cached data of the specified haptic. If not defined, false will be passed to keep the cached data by default.
Returns
  • 0: success
  • 1: failure

◆ PauseHapticBuffer()

static int PauseHapticBuffer ( int  sourceId)
static

Pauses a specified buffered haptic.

Parameters
sourceIdThe source ID returned by SendHapticBuffer. Set it to the target source ID to stop a specific buffered haptic.
Returns
  • 0: success
  • -1: failure

◆ ResumeHapticBuffer()

static int ResumeHapticBuffer ( int  sourceId)
static

Resumes a paused buffered haptic.

Parameters
sourceIdThe source ID returned by SendHapticBuffer. Set it to the target source ID to resume a specific buffered haptic.
Returns
  • 0: success
  • -1: failure

◆ StartHapticBuffer()

static int StartHapticBuffer ( int  sourceId)
static

Starts a specified buffered haptic.

Note
If you pass CacheNoVibrate in SendHapticBuffer, call this API if you want to start haptic after caching the data.
Parameters
sourceIdThe source ID returned by SendHapticBuffer when there is cached data for the haptic.
Returns
  • 0: success
  • -1: failure

◆ UpdateHapticBuffer()

static int UpdateHapticBuffer ( int  sourceId,
VibrateType  vibrateType,
ChannelFlip  channelFlip,
float  amplitudeScale 
)
static

Updates the settings for a specified buffered haptic.

Parameters
sourceIdThe source ID returned by SendHapticBuffer. Set it to the target source ID to update a specific buffered haptic.
vibrateTypeThe controller(s) that the vibration is applied to:
  • None
  • LeftController
  • RightController
  • BothController
channelFlipDetermines whether to enable audio channel inversion. Once enabled, the left controller vibrates with the audio data from the right channel, and vice versa.
  • Yes: enable
  • No: disable
    Parameters
    amplitudeScaleVibration amplitude, the higher the amplitude, the stronger the haptic effect. The valid value range from 0 to 2:
    0: no vibration
  • 1: standard amplitude
  • 2: 2×standard amplitude
Returns
  • 0: success
  • -1: failure

◆ CreateHapticStream()

static int CreateHapticStream ( string  phfVersion,
UInt32  frameDurationMs,
ref VibrateInfo  hapticInfo,
float  speed,
ref int  id 
)
static

Creates a haptic stream.

Parameters
phfVersionThe version of the PICO haptic file (PHF) that the stream uses.
frameDurationMsInterframe space, which is the amount of time in milliseconds existing between the transmissions of frames.
hapticInfoThe information about this haptic stream you create.
speedThe streaming speed.
idReturns the ID of the stream.
Returns
  • 0: success
  • 1: failure

◆ WriteHapticStream()

static int WriteHapticStream ( int  id,
ref PxrPhfParamsNum  frames,
UInt32  numFrames 
)
static

Writes haptic data to a specified stream.

Parameters
idThe ID of the target stream.
framesThe data contained in the PICO haptic file (PHF).
numFramesThe number of frames.
Returns
  • 0: success
  • 1: failure

◆ SetHapticStreamSpeed()

static int SetHapticStreamSpeed ( int  id,
float  speed 
)
static

Sets a transmission speed for a specified haptic stream.

Parameters
idThe ID of the stream.
speedThe transmission speed to set for the stream.
Returns
  • 0: success
  • 1: failure

◆ GetHapticStreamSpeed()

static int GetHapticStreamSpeed ( int  id,
ref float  speed 
)
static

Gets the transmission speed of a specified haptic stream.

Parameters
idThe ID of the stream.
speedReturns the stream's transmission speed.
Returns
  • 0: success
  • 1: failure

◆ GetHapticStreamCurrentFrameSequence()

static int GetHapticStreamCurrentFrameSequence ( int  id,
ref UInt64  frameSequence 
)
static

Gets the No. of the frame that the controller currently plays.

Parameters
idThe ID of the haptic stream that triggers the vibration.
frameSequenceReturns the current frame's sequence No.
Returns
  • 0: success
  • 1: failure

◆ StartHappticStream()

static int StartHappticStream ( int  source_id)
static

Starts the transmission of a specified haptic stream.

Parameters
source_idThe ID of the haptic stream.
Returns
  • 0: success
  • 1: failure

◆ StopHappticStream()

static int StopHappticStream ( int  source_id)
static

Stops the transmission of a specified haptic stream.

Parameters
source_idThe ID of the haptic stream.
Returns
  • 0: success
  • 1: failure

◆ RemoveHappticStream()

static int RemoveHappticStream ( int  source_id)
static

Removes a specified haptic stream.

Parameters
source_idThe ID of the stream.
Returns
  • 0: success
  • 1: failure

◆ AnalysisHappticStreamPHF()

static PxrPhfFile AnalysisHappticStreamPHF ( TextAsset  phfText)
static

Parses the haptic data in a specified PICO haptic file (PHF).

Parameters
phfTextThe PICO haptic file (.json) to parse.

◆ SetArmModelParameters()

static void SetArmModelParameters ( PxrGazeType  gazetype,
PxrArmModelType  armmodeltype,
float  elbowHeight,
float  elbowDepth,
float  pointerTiltAngle 
)
static

Sets arm model parameters on PICO G3.

Parameters
gazetypeGaze type, which is used to define the way of getting the HMD data.
armmodeltypeArm model type
elbowHeightThe elbow's height, which changes the arm's length.Value range: (0.0f, 0.2f). The default value is 0.0f.
elbowDepthThe elbow's depth, which changes the arm's position.Value range: (0.0f, 0.2f). The default value is 0.0f.
pointerTiltAngleThe ray's tilt angle. Value range: (0.0f, 30.0f). The default value is 0.0f.

◆ GetControllerHandness()

static void GetControllerHandness ( ref int  deviceID)
static

Gets the current user's dominant hand in the system on PICO G3.

Parameters
deviceID