Triggering Haptic Clips
🔥NOTE: At the time of this writing, the Studio plug-in for Unity is in beta and has very limited functionality. Specifically, it is currently possible to only load one haptic clip into a Haptic Source per GameObject and play only one Haptic Source at any given time. Future beta releases will address this limitation.
Triggering the Haptic Source
of a GameObject can be achieved via simple Play and Stop commands.
Play
This function plays back the haptic clip specified with the GameObject’s Haptic Source
. In this current beta version, playback of a haptic source is not triggered automatically (e.g. by proximity between the Haptic Receiver
and the game object the Haptic Source
is attached to) and must always be triggered with this function.
hapticSource.Play()
NOTE: In this version, the haptic clip will always be played unaltered—no attempts will be made to change the haptic intensity, position, or speed based on the location of the
Haptic Source
relative to theHaptic Receiver
.
Stop
This function can stop the playback of a Haptic Source
if it’s currently playing; if not playing, this function will do nothing.
hapticSource.Stop()
Unity Example Project
Included in the Lofelt Studio download is an example Unity project that makes use of the Studio plug-in for generating haptics. It shows an example of how to load separate haptic clips onto two different buttons and then play them individually when clicked. You can find the project in the Studio download at sdk/examples/unity/LofeltHapticsExample
.