Haptic assets
The plugin ships a set of sample .ts_asset haptic assets under TS/TSAssets/Haptic. These are portable haptic playables authored in Teslasuit Studio and imported into Unity as assets you can load and play at runtime. They are keyed to generic body part names, so they are reusable across scenes and devices.
A .ts_asset file imports into a plugin asset derived from TsAssetBase. You do not construct these directly: the editor import pipeline reads the bytes, detects the type, and produces the right asset, and at runtime TsAssetBase.Instance loads the native asset on first use. Depending on its contents a file becomes one of three types:
| Asset type | Class | Contents |
|---|---|---|
| Preset or scene animation | TsHapticAnimationAsset | A timed haptic animation you play through a player. |
| Haptic effect | TsHapticEffectAsset | An effect building block, combined into materials. |
| Touch sequence | TsTouchSequenceAsset | An ordered sequence of touches. |
Note. Type detection during import needs the native libraries loaded. On a cold start, before the libraries have finished loading, a freshly imported .ts_asset can resolve to an undefined type. If a newly added asset does not resolve correctly, reimport it once the project has fully loaded.
The assets included#
The bundled samples give a working example of each kind of playback. Names like RightLowerArmPW40A50F75 encode both the target body part and the touch parameters (pulse width 40, amplitude 50, frequency 75), so you can tell what an asset does before opening it.
| File | Purpose |
|---|---|
Preset | A general haptic preset animation. |
effect_linear_0-100 | An effect ramping linearly from 0 to 100. |
sample_50_150 | A sample animation for playback tests. |
GloveEffectLinear | A linear effect aimed at the glove. |
GloveSequenceMax | A touch sequence at maximum parameters for the glove. |
RightLowerArmPW40A50F75 | A preset for the right lower arm, encoding pulse width 40, amplitude 50, frequency 75. |
Playing an asset#
Get a playable from a TsHapticPlayer by passing the asset instance, then play it.
[SerializeField] private TsHapticPlayer m_player; // requires a TsDeviceBehaviour
[SerializeField] private TsHapticAnimationAsset m_asset;
void PlayPreset()
{
IHapticPlayable playable = m_player.GetPlayable(m_asset.Instance as IHapticAsset);
playable.Play();
}For a full walkthrough see the Haptic animation playback example.
Safety. Presets carry fixed amplitude, frequency, and pulse width. Confirm the device is calibrated and start with low-intensity presets before running anything at maximum, such as GloveSequenceMax.
What to read next#
- Getting started: how to add your own
.ts_assetfiles to a project. - Haptics & EMS concept: the haptic model behind these playables.
- Playing touches example: building a touch in code instead of loading a preset.
