Feel
5.1
The best way to improve your game's feel and make it extra juicy
|
Provides haptic playback functionality for a single haptic clip. More...
Public Member Functions | |
void | Play () |
Loads and plays back the haptic clip. More... | |
void | Stop () |
Stops playback that was previously started with Play(). More... | |
void | Seek (float time) |
Sets the time position to jump to when Play() is called. More... | |
void | OnDisable () |
When a GameObject is disabled, stop playback if this HapticSource is playing. More... | |
Public Attributes | |
HapticClip | clip |
The HapticClip this HapticSource loads and plays. More... | |
int | priority = DEFAULT_PRIORITY |
The priority of the HapticSource More... | |
Properties | |
HapticPatterns.PresetType | fallbackPreset [get, set] |
The haptic preset to be played when it's not possible to play a haptic clip More... | |
bool | loop [get, set] |
Set the haptic source to loop playback of the haptic clip. More... | |
float | level [get, set] |
The level of the haptic source More... | |
float | frequencyShift [get, set] |
This shift is added to the frequency of every breakpoint in the clip, including the emphasis. More... | |
Provides haptic playback functionality for a single haptic clip.
HapticSource plays back the HapticClip assigned in the clip property when calling Play(). It also provides various ways to control playback, such as seeking, looping and amplitude/frequency modulation.
When a gamepad is connected, the haptic clip will be played back on that gamepad. See the HapticController documentation for more details about gamepad support.
At the moment, playback of a haptic source is not triggered automatically by e.g. proximity between the HapticReceiver and the HapticSource, so you need to call Play() to trigger playback.
You can place multiple HapticSource components in your scene, with a different HapticClip assigned to each.
HapticSource provides a per-clip MonoBehaviour
API for the functionality in HapticController, while HapticReceiver provides a MonoBehaviour
API for the global functionality in HapticController.
HapticSourceInspector
provides a custom editor for HapticSource for the Inspector.
void Lofelt.NiceVibrations.HapticSource.OnDisable | ( | ) |
When a GameObject
is disabled, stop playback if this HapticSource is playing.
void Lofelt.NiceVibrations.HapticSource.Play | ( | ) |
Loads and plays back the haptic clip.
At the moment only one haptic clip at a time can be played. If another HapticSource is currently playing and has lower priority, its playback will be stopped.
If a seek time within the time range of the clip has been set with Seek(), it will jump to that position if loop is false
. If loop is true
, seeking will have no effect.
It will loop playback in case loop is true
.
void Lofelt.NiceVibrations.HapticSource.Seek | ( | float | time | ) |
void Lofelt.NiceVibrations.HapticSource.Stop | ( | ) |
Stops playback that was previously started with Play().
HapticClip Lofelt.NiceVibrations.HapticSource.clip |
The HapticClip this HapticSource loads and plays.
int Lofelt.NiceVibrations.HapticSource.priority = DEFAULT_PRIORITY |
The priority of the HapticSource
This property is set by HapticSourceInspector
. 0 is the highest priority and 256 is the lowest priority.
The default value is 128.
|
getset |
The haptic preset to be played when it's not possible to play a haptic clip
|
getset |
This shift is added to the frequency of every breakpoint in the clip, including the emphasis.
See HapticController::clipFrequencyShift for further details.
|
getset |
The level of the haptic source
Haptic source level is applied in combination with output level (which can be set on either HapticReceiver or HapticController according to preference), to the currently playing haptic clip. The combination of these two levels and the amplitude within the loaded haptic at a given moment in time determines the strength of the vibration felt on the device. See HapticController::clipLevel for further details.
|
getset |
Set the haptic source to loop playback of the haptic clip.
It will only have any effect once Play() is called.
See HapticController::Loop() for further details.