Skip to content

Adaptive triggers

DualSense triggers can resist, click, or vibrate as the player pulls them. They need the L1 WebHID connection. On other controllers these calls do nothing, so you can call them unconditionally.

p1.triggers.applyPreset('weapon', 'right'); // side: 'left' | 'right' | 'both' (default 'both')
p1.triggers.applyPreset('off');
Preset Effect
'weapon' A resistance wall that gives way, like a gun trigger
'heavy_weapon' A later, stiffer wall
'bow' Resistance that builds as you pull
'abs' Vibration once pulled past a point, like ABS braking
'soft_wall' Gentle constant resistance from mid-pull
'rapid_pulse' Fast vibration through most of the pull
'precision_damp' Light resistance for fine control
'off' No effect
p1.triggers.setRight({ type: 'weapon', startZone: 2, endZone: 5, strength: 7 });
p1.triggers.setLeft({ type: 'slope', startZone: 1, endZone: 8, startStrength: 1, endStrength: 7 });
p1.triggers.setBoth({ type: 'feedback', startZone: 4, strength: 4 }, { type: 'off' });

The pull is divided into zones 0 (rest) to 9 (fully pressed). Strengths run from 1 to 8.

Type Fields Behavior
'feedback' startZone, strength Constant resistance from startZone to the end
'slope' startZone, endZone, startStrength, endStrength Resistance that ramps between two zones
'weapon' startZone, endZone, strength A wall between two zones that snaps when passed
'vibration' startZone, amplitude, frequencyHz Vibration from startZone onward
'off' Releases the trigger

Trigger effects only reach the controller once WebHID is connected, so set them again when capabilities change:

const syncTriggers = () => p1.triggers.applyPreset('weapon', 'right');
syncTriggers();
hub.onCapabilitiesChange(syncTriggers);

Reset with p1.triggers.reset() when leaving a mode that used them. hub.dispose() and page exit reset every controller automatically.

Xbox Series controllers have small motors in each trigger. Chrome and Edge expose them without WebHID:

p1.triggers.pulseImpulse({ left: 0, right: 0.8, durationMs: 80 });

Haptic presets already use these motors when they are the best output available.