Microtube Docs
EN中文
Developers / Unreal / Haptics setup

Unreal haptics setup

How HEXR haptics work, how to add them with components or from Blueprint and C++, and how to make them feel right.

How haptics work

The hand-near check

The Pressure Controller’s calls only fire while the hand is near something: holding it, hovering a finger over it, or inside a HexR Proximity Check. That stops a stray call pressing an empty hand. HEXR components skip the check, because a touch point inside them is proof enough. The Remove calls always work, and your own calls can skip the check (below).

Add haptics without code

Add these in the Components panel like any other component, then size the box in the viewport. The box is hidden in game.

The fastest start: select meshes in the viewport or the Outliner and choose Tools → HexR → Make Selected Grabbable. Each gets physics and a HexR Grabbable sized to it, in one step you can undo.

Pick up an object — HexR Grabbable

For an object whose root is a mesh with Simulate Physics on. Pinch it, or close your palm around it, and every finger touching it presses.

SettingWhat it does
Type Of GrabPinch Grab (thumb and a finger) or Palm Grab
Haptic StrengthHow hard the touching fingers are pressed, 10–60
Gravity on ReleaseLet it fall when let go
Grab TargetGrab one part of the actor, such as a heart off its stand. Empty grabs the whole actor
Simulate Physics on ReleaseDrop it with physics when let go, even if it wasn’t simulating
EventsOn Grabbed, On Grab Released

Press a button — HexR Physical Button

A button a fingertip pushes in. The finger feels it while the button is down.

SettingWhat it does
Index, Thumb, …Which fingers can press it. Index only by default
CapThe mesh that moves
Travel, Press DirectionHow far it moves, in centimetres, and which way
Press PressureHow hard the finger is pressed while the button is down, 10–60
EventsOn Button Pressed, On Button Released

Fire, water and a heartbeat — HexR Fire, Water and Heartbeat

ComponentWhat you feelMain settings
HexR FireThe fingers in the flame buzz. It can be lit and put out, and it switches its flame, sound and light with itLit, Frequency (35 Hz), Intensity, Flicker. Can Catch Fire: a torch dipped in a lit fire lights. Water Puts Out. Effects: the flame’s components
HexR WaterPool: a pulse on the way in, a soft hold that slowly swells, a swish when the hand moves. Stream: random drops on the fingers and a fizz in the palmMode, Shape (Box, or Cylinder for a round basin or a jet), Splash System, Ripple System, Splash Sound
HexR HeartbeatLub-dub in the palm and on the fingertips that touch it. With no hand on it, it keeps beating, seen and heardRhythm: Healthy (72 BPM), Running (climbs to 150 and drops the second beat) or Uneven (atrial fibrillation). Pulse Target squeezes a mesh on each beat. Lub Sound, Dub Sound

Their events are On Ignited and On Extinguished (fire), On Splash (water) and On Beat (heartbeat). While the game runs, Ignite, Extinguish and Set Rhythm change them.

Put it back — HexR Return Home

Floats an object back to where it started once it is let go. Pair it with a HexR Grabbable’s Simulate Physics on Release: the object drops, then flies home. Wait After Release (0.8 s) sets how long it waits once no hand is near. Its event is On Returned Home.

Other components

ComponentUse it for
HexR Special HapticsA zone with a ready-made effect, picked in Type Of Haptics: Fountain Effect, Rain Drop Effect, Heart Beat Effect, Hand Squeeze Effect (which fires On Squeezed), Custom Vibrations or Custom Haptics
HexR UsableEvents when the chosen fingers curl and uncurl around it, like a spray can’s trigger: On Used and On Stopped Using. Use Threshold sets how far
HexR Proximity CheckOpens the hand-near check while a hand is inside, for your own Pressure Controller calls. Clear Delay keeps it open briefly after the hand leaves
HexR Interactable HapticsPressure while an object is held through an interaction toolkit, following how tightly the hand closes. HEXR adds it to VR Template grabs itself (below). For another toolkit, call Notify Grabbed and Notify Released from its grab and drop events

Every HEXR component above, except Return Home and Interactable Haptics, also has On Touch Begin and On Touch End. They give the hand, the finger and the touch point: use them for a splash, a sound or a sparkle.

Which component do I need?

You wantUse
To pick something upHexR Grabbable
A button to pressHexR Physical Button
Fire, water or a heartbeat to feelHexR Fire, HexR Water, HexR Heartbeat
A VR Template grab to be feltNothing: HEXR adds it (below)
Something held through another toolkit to be feltHexR Interactable Haptics
A trigger the fingers squeezeHexR Usable
A ready-made rain, fountain or squeeze zoneHexR Special Haptics
Your own effectBlueprint or C++ (below)

Examples to copy

The plugin comes with a demo level and seven example Blueprints, each with comments on its HEXR parts. To see them, open the Content Browser’s Settings menu, tick Plugin Content and go to Plugins → HexR. The demo level is Demo/L_HexRDemo, and the examples are in Examples.

BlueprintWhat it shows
BP_HexR_GrabbableCubeHexR Grabbable, and its On Grabbed event
BP_HexR_PushButtonHexR Physical Button with a moving cap, and On Button Pressed / Released
BP_HexR_HeartBeatHexR Special Haptics, Heart Beat Effect: a pulse under the fingertips
BP_HexR_RainCloudHexR Special Haptics, Rain Drop Effect: drops on the palm
BP_HexR_FountainHexR Special Haptics, Fountain Effect: running water on the fingers
BP_HexR_SqueezeBallHexR Special Haptics, Hand Squeeze Effect, and On Squeezed
BP_HexR_SprayCanHexR Usable: On Used / On Stopped Using as the fingers curl around it and let go

The tutorial project’s HexR Developer Demo shows Fire, Water, Heartbeat and Return Home together: see The Developer Demo.

VR Template grabs, with no wiring

In a project made from Unreal’s Virtual Reality template, every object with the template’s grab component presses the fingers of the hand holding it. The pressure follows how tightly the hand closes. HEXR finds those objects when play starts, and in anything spawned later. There is nothing to add.

Unreal’s own haptics on the gloves

Unreal’s controller haptics, the Play Haptic Effect and Set Haptics by Value nodes, also play on the glove of the same hand. An existing project’s haptic effects are felt with no HEXR calls. Choose how in Project Settings → Plugins → HexR → Unreal Haptics:

A haptic curve changes every frame, so HEXR sends each glove at most ten updates a second and skips changes too small to feel. A stop always goes out at once.

Trigger haptics from Blueprint

Every HEXR node is in the HexR category of the Blueprint action menu.

Trigger haptics from C++

One finger

Press or vibrate one channel through the hand’s Pressure Controller. The last argument skips the hand-near check.

cpp
#include "HexRPressureController.h"
#include "HexRTouchPoint.h"   // UHexRTouchLibrary

// The level's Pressure Controller for that hand, or null if the pawn has none
UHexRPressureController* Hand = UHexRTouchLibrary::GetPressureController(this, EHexRHand::Right);
if (!Hand) return;

// Pressure: finger, on/off, intensity 0.1-1, ramp speed 0.1-1, skip the hand-near check
Hand->CustomSingleHaptics(EHexRFinger::Index, true, 0.5f, 1.f, false);

// Vibration: finger, on/off, intensity 0.1-1, frequency 0.1-40 Hz, skip the hand-near check
Hand->CustomSingleVibrations(EHexRFinger::Palm, true, 0.7f, 12.f, false);

// A component strength (10-60) as an intensity (0.1-1)
const float Intensity = UHexRTouchLibrary::StrengthToIntensity(30.f);

Several fingers

The same setting on several channels at once.

cpp
// One entry per channel: Thumb, Index, Middle, Ring, Pinky, Palm
const TArray<bool> Grip = { true, true, true, false, false, false };

Hand->TriggerCustomHapticsIncrease(Grip, 0.6f, 1.f);   // pressure 0.1-1, speed 0.1-1
Hand->TriggerCustomVibrations(Grip, 0.7f, 12.f);       // intensity 0.1-1, frequency 0.1-40 Hz
Hand->TriggerAllHapticsIncrease(0.5f);                 // every channel
Hand->TriggerPinchPressure(0.6f);                      // thumb and index together

Press the finger that touches

Press exactly the finger that enters your own box, and let go when it leaves.

cpp
// Presses exactly the finger or palm that touches Box, and lets go when it leaves.
// Box: a UBoxComponent on your actor with Generate Overlap Events on, overlapping WorldDynamic.
void AMyPad::BeginPlay()
{
    Super::BeginPlay();
    Box->OnComponentBeginOverlap.AddDynamic(this, &AMyPad::OnTouchBegin);
    Box->OnComponentEndOverlap.AddDynamic(this, &AMyPad::OnTouchEnd);
}

void AMyPad::OnTouchBegin(UPrimitiveComponent* Self, AActor* Other, UPrimitiveComponent* Comp,
                          int32 BodyIndex, bool bFromSweep, const FHitResult& Hit)
{
    EHexRHand Hand;
    EHexRFinger Finger;
    if (UHexRTouchLibrary::GetTouchPointInfo(Comp, Hand, Finger))
    {
        UHexRTouchLibrary::TriggerFixPressure(Comp, 0.5f);   // 0.1-1, skips the hand-near check
    }
}

void AMyPad::OnTouchEnd(UPrimitiveComponent* Self, AActor* Other, UPrimitiveComponent* Comp, int32 BodyIndex)
{
    EHexRHand Hand;
    EHexRFinger Finger;
    if (UHexRTouchLibrary::GetTouchPointInfo(Comp, Hand, Finger))
    {
        UHexRTouchLibrary::RemoveHaptics(Comp);
    }
}

Letting go

Release one finger, one hand, or the whole glove.

cpp
Hand->RemoveIndexHaptics();      // one finger: RemoveThumbHaptics() ... RemovePalmHaptics()
Hand->RemoveAllHaptics();        // every channel's pressure on this hand
Hand->RemoveAllVibrations();     // every channel's vibration on this hand
Glove->ReleaseAllChannels();     // everything on the glove

Straight to the glove

Skip the Pressure Controller and its check.

cpp
#include "HexRGlove.h"

// Straight to the glove: no Pressure Controller, no hand-near check.
UHexRGlove* Glove = UHexRTouchLibrary::GetGlove(EHexRHand::Right);
if (Glove && Glove->IsConnected())
{
    Glove->SendPressure(EHexRFinger::Index, true, 0.8f, 1.f);    // intensity 0.1-1, speed 0.1-1
    Glove->SendVibration(EHexRFinger::Palm, true, 18.f, 0.7f);   // here frequency comes BEFORE intensity
    FHexRChannelState Last = Glove->GetChannelState(EHexRFinger::Index);   // what was last sent
}

Glove effects

For effects you time yourself, such as a heartbeat or a water drop, the glove has Press, Press Hand, Vibrate, Stop Vibration, Release, Pulse and Pulse Hand. They are in the Blueprint category HexR → Glove → Effects.

Each takes a set of channels, so one call covers a whole hand. A pulse lets go by itself. Short pulses are kept intact even when Bluetooth batches the writes: how.

cpp
#include "HexRGlove.h"

// A channel mask (EHexRChannels bits) says which channels, so one call covers a hand.
UHexRGlove* Glove = UHexRTouchLibrary::GetGlove(EHexRHand::Right);
if (!Glove || !Glove->IsConnected()) return;

const int32 Index = HexR::ChannelBit(EHexRFinger::Index);
Glove->Press(HexR::ChannelsFingers, 0.6f);              // thumb to pinky, held until released
Glove->Vibrate(Index, 35.f, 0.3f);                      // frequency 0.1-40 Hz, intensity 0.1-1
Glove->Pulse(HexR::ChannelsAll, 0.8f, 0.1f);            // a tap that lets go by itself after 0.1 s
Glove->PulseHand(HexR::ChannelsAll, 0.85f, 0.65f, 0.13f);   // palm and fingers at different strengths
Glove->StopVibration(Index);                            // a channel pressing steadily keeps pressing
Glove->Release(HexR::ChannelsAll);                      // pressure and vibration off

Designing haptics

Two modes, and a few settings that change how they feel:

ModeSettingWhat it changes
PressureIntensity 0.1–1How hard it presses: about 15 to 50 kPa
PressureSpeed 0.1–1How fast it gets there. At 1, about 0.3 s to the firmest press; at 0.1, ten times slower
Vibration0.1–5 HzSeparate pulses you can count. Intensity sets how hard each one presses
Vibration5–40 HzA continuous buzz. Intensity sets how long each pulse lasts

Tips

A glove holds its last pressure

Nothing on the glove lets go by itself. HEXR releases on disconnect, when play ends, on pause and on quit. If the app crashes or the link drops, the glove keeps pressing: switch the arm module off.

Next

Try it all in a finished project: Tutorial walkthrough.