API reference

HapticSource Class

Extends MonoBehaviour, ISerializationCallbackReceiver
Provides playback functionality for a single haptic clip by wrapping HapticClipPlayer.
If you don't need a MonoBehaviour and a C# class would be more suitable, use HapticClipPlayer instead. It has the same functionality.
Once you have assigned a HapticClip to the clip property you can play the HapticSource, enable or disable looping, and modulate the amplitude and frequency.
You can place multiple HapticSource components in your scene, with a different HapticClip assigned to each.

Fields

clipDuration : float
The duration of the assigned HapticClip in seconds.
Signature
float Oculus.Haptics.HapticSource.clipDuration

Properties

amplitude : float
[Get][Set]
Sets/gets the HapticSource's amplitude.
See HapticClipPlayer.amplitude for details.
Signature
float Oculus.Haptics.HapticSource.amplitude
clip : HapticClip
[Set]
Assigns a HapticClip to this HapticSource.
See also: HapticClipPlayer.Play(Controller).
For details on playback states and playback behaviour, see HapticClipPlayer.
Signature
HapticClip Oculus.Haptics.HapticSource.clip
controller : Controller
[Set]
Assigns a physical controller to this HapticSource that haptics should output to.
The controller will only be applied the next time Play() is called. It can also be assigned as an argument to Play(Controller) if preferred.
Signature
Controller Oculus.Haptics.HapticSource.controller
frequencyShift : float
[Get][Set]
Sets/gets the HapticSource's frequency shift.
Signature
float Oculus.Haptics.HapticSource.frequencyShift
loop : bool
[Get][Set]
Signature
bool Oculus.Haptics.HapticSource.loop
priority : uint
[Get][Set]
Sets/gets the HapticSource's playback priority.
See HapticClipPlayer.priority for details.
Signature
uint Oculus.Haptics.HapticSource.priority

Protected Methods

OnDestroy ()
Ensures that the lifetime of the wrapped HapticClipPlayer matches that of the HapticSource.
Signature
virtual void Oculus.Haptics.HapticSource.OnDestroy()
Returns
void

Methods

OnAfterDeserialize ()
Serialization callback from the ISerializationCallbackReceiver interface. HapticSource uses it to synchronize the properties of the wrapped HapticClipPlayer to the serializable fields on this HapticSource. This occurs whenever a user updates any of the values on the custom inspector or whenever Unity loads the persisted data.
Signature
void Oculus.Haptics.HapticSource.OnAfterDeserialize()
Returns
void
OnBeforeSerialize ()
Serialization callback from the ISerializationCallbackReceiver interface. Unused for now but declared to fulfill the interface.
Signature
void Oculus.Haptics.HapticSource.OnBeforeSerialize()
Returns
void
Pause ()
Pause playback of the HapticSource.
See also: HapticClipPlayer.Pause().
For details on playback states and playback behaviour, see HapticClipPlayer.
Signature
void Oculus.Haptics.HapticSource.Pause()
Returns
void
Play ()
Starts playback of the HapticClip that has been assigned with the clip property from the start of the clip.
All properties applied to this HapticSource will be effective during playback.
Although multiple HapticSources can play simultaneously, the output of only one will be felt at any given moment on a given controller.
See HapticClipPlayer.priority for a description of how this works.
For further information on Play() see HapticClipPlayer.Play(Controller).
For more details on playback states and playback behaviour, see HapticClipPlayer.
Signature
void Oculus.Haptics.HapticSource.Play()
Returns
void
Play ( controller )
Starts playback of the HapticClip that has been assigned with the clip property on the controller passed by argument.
The controller assigned to this HapticSource will be reassigned to the one passed to this method.
For more information on playback behaviour see Play() and HapticClipPlayer.
Signature
void Oculus.Haptics.HapticSource.Play(Controller controller)
Parameters
controller: Controller  The physical controller to play haptics on.
Returns
void
Resume ()
Resume playback of the HapticSource.
See also: HapticClipPlayer.Resume().
For details on playback states and playback behaviour, see HapticClipPlayer.
Signature
void Oculus.Haptics.HapticSource.Resume()
Returns
void
Seek ( time )
Seeks the current playback position of the HapticSource.
See also: HapticClipPlayer.Seek().
For details on playback states and playback behaviour, see HapticClipPlayer.
Signature
void Oculus.Haptics.HapticSource.Seek(float time)
Parameters
time: float
Returns
void
Stop ()
Stops playback of the HapticSource.
See also: HapticClipPlayer.Stop().
For details on playback states and playback behaviour, see HapticClipPlayer.
Signature
void Oculus.Haptics.HapticSource.Stop()
Returns
void