API reference

UMetaXRHapticsPlayerComponent Class

Extends UActorComponent
Component for playing back haptic clips (UMetaXRHapticClip).
After setting a haptic clip with the HapticClip property, playback can be started with Play() or PlayWithInputs().
The properties Amplitude, FrequencyShift, Priority and bIsLooping control playback.
See the documentation for an example of using the Meta XR Haptics Player Component.

Constructors

UMetaXRHapticsPlayerComponent ()
Signature
UMetaXRHapticsPlayerComponent::UMetaXRHapticsPlayerComponent()

Member Functions

GetAmplitude ()
Getter for the Amplitude property.
See SetAmplitude() for more details
Signature
float UMetaXRHapticsPlayerComponent::GetAmplitude() const
Returns
float
GetClipDuration ()
Gets the duration in seconds of the haptic clip.
Signature
float UMetaXRHapticsPlayerComponent::GetClipDuration() const
Returns
float
GetController ()
Getter for the Controller property.
Signature
EMetaXRHapticController UMetaXRHapticsPlayerComponent::GetController() const
GetFrequencyShift ()
Getter for the FrequencyShift property.
See SetFrequencyShift() for more details
Signature
float UMetaXRHapticsPlayerComponent::GetFrequencyShift() const
Returns
float
GetHapticClip ()
Getter for the HapticClip property.
Signature
UMetaXRHapticClip * UMetaXRHapticsPlayerComponent::GetHapticClip() const
GetLooping ()
Getter for the bIsLooping property.
See SetLooping() for more details
Signature
bool UMetaXRHapticsPlayerComponent::GetLooping() const
Returns
bool
GetPriority ()
Getter for the Priority property.
See SetPriority() for more details
Signature
int32 UMetaXRHapticsPlayerComponent::GetPriority() const
Returns
int32
Pause ()
Pauses playback on the HapticClipPlayer.
Signature
void UMetaXRHapticsPlayerComponent::Pause()
Returns
void
Play ()
Start playback of the haptic clip set with the HapticClip property.
Signature
void UMetaXRHapticsPlayerComponent::Play()
Returns
void
PlayOnController ( InController )
Start playback of the haptic clip set with the HapticClip property on the specified controller.
Does not set the Controller property.
Signature
void UMetaXRHapticsPlayerComponent::PlayOnController(const EMetaXRHapticController InController)
Parameters
InController: const EMetaXRHapticController  Which controller should play the haptic clip.
Returns
void
PlayWithInputs ( InController , InPriority , InAmplitude , InFrequencyShift , bInIsLooping )
Starts playback on the HapticClipPlayer with custom inputs.
This is a convenience method that sets the properties corresponding to the input parameters, it then starts playback.
Signature
void UMetaXRHapticsPlayerComponent::PlayWithInputs(const EMetaXRHapticController InController, const int32 InPriority=512, const float InAmplitude=1.0f, const float InFrequencyShift=0.0f, const bool bInIsLooping=false)
Parameters
InController: const EMetaXRHapticController  Which Controller should play the haptic clip.
InPriority: const int32  Playback Priority, ranging from 0 (low priority) to 1024 (high priority).
InAmplitude: const float  Amplitude scale, ranging from 0.0 to infinite.
InFrequencyShift: const float  FrequencyShift, ranging from -1.0 to 1.0.
bInIsLooping: const bool  Whether playback should loop, see bIsLooping
Returns
void
Resume ()
Resumes playback on the HapticClipPlayer. Calling Resume() on a playing player has no effect.
Signature
void UMetaXRHapticsPlayerComponent::Resume()
Returns
void
Seek ( Time )
Seeks the current playback position of the HapticClip.
Signature
void UMetaXRHapticsPlayerComponent::Seek(const float Time) const
Parameters
Time: const float  The target playback position in seconds.
Returns
void
SetAmplitude ( InAmplitude )
Setter for the Amplitude property.
The amplitude scale controls the vibration intensity during playback.
During playback, the individual amplitudes in the clip will be multiplied by the player's amplitude. This changes how strong the vibration is. Amplitude values in a clip range from 0.0 to 1.0, and the result after applying the amplitude scale will be clipped to that range.
An amplitude of 0.0 means that no vibration will be triggered, and an amplitude of 0.5 will result in the clip being played back at half of its amplitude.
Example: if you apply amplitude of 5.0 to a haptic clip and the following amplitudes are in the clip: [0.2, 0.5, 0.1], the initial amplitude calculation would produce these values: [1.0, 2.5, 0.5] which will then be clamped like this: [1.0, 1.0, 0.5]
You can change the property during active playback, in which case the amplitude is applied immediately, with a small delay in the tens of milliseconds.
Signature
void UMetaXRHapticsPlayerComponent::SetAmplitude(const float InAmplitude=1.0f)
Parameters
InAmplitude: const float  The amplitude to set, has to be higher or equal to zero.
Returns
void
SetController ( InController )
Setter for the Controller property.
Signature
void UMetaXRHapticsPlayerComponent::SetController(const EMetaXRHapticController &InController)
Parameters
InController: const EMetaXRHapticController &  The controller to set.
Returns
void
SetFrequencyShift ( InFrequencyShift )
Setter for the FrequencyShift property.
The frequency shift controls the vibration frequency during playback.
During playback, the individual frequencies in the clip will be shifted up or down. The acceptable range of values is -1.0 to 1.0 inclusive. Once the frequencies in a clip have been shifted, they will be clamped to the playable range of frequency values, i.e. zero to one. Setting this property to 0.0 means that the frequencies will not be changed.
Example: if you apply a frequency shift of 0.8 to a haptic clip and the following frequencies are in the clip: [0.1, 0.5, 0.0], the initial frequency shift calculation will produce these frequencies: [0.9, 1.3, 0.8] which will then be clamped like this: [0.9, 1.0, 0.8]
You can change the property during active playback, in which case the frequency shift is applied immediately, with a small delay in the tens of milliseconds.
Signature
void UMetaXRHapticsPlayerComponent::SetFrequencyShift(const float InFrequencyShift=0.0f)
Parameters
InFrequencyShift: const float  The frequency shift to set, acceptable range of values is -1.0 to 1.0 inclusive
Returns
void
SetHapticClip ( InHapticClip )
Setter for the HapticClip property.
Signature
void UMetaXRHapticsPlayerComponent::SetHapticClip(UMetaXRHapticClip *InHapticClip)
Parameters
InHapticClip: UMetaXRHapticClip *  The haptic clip to set.
Returns
void
SetLooping ( bInIsLooping )
Setter for the bIsLooping property.
When looping is enabled, clip playback will be repeated indefinitely.
Looping can be enabled or disabled during playback.
Signature
void UMetaXRHapticsPlayerComponent::SetLooping(const bool bInIsLooping=false)
Parameters
bInIsLooping: const bool  whether playback is looped.
Returns
void
SetPriority ( InPriority )
Setter for the Priority property.
When multiple players are playing at the same time on the same controller, only the player with the highest priority will trigger vibrations.
If multiple players have the same priority level, then the player that was started most recently will trigger vibrations.
The priority can be any integer value between 0 (low priority) and 1024 (high priority). The default value is 512.
You can change the player's priority before and during playback.
Signature
void UMetaXRHapticsPlayerComponent::SetPriority(const int32 InPriority=512)
Parameters
InPriority: const int32  The priority to set, can be any integer value between 0 (low priority) and 1024 (high priority).
Returns
void
Stop ()
Stops playback on the HapticClipPlayer.
Signature
void UMetaXRHapticsPlayerComponent::Stop()
Returns
void