Home › How do I…? › How to add a pressable button in VR

How to add a pressable button in VR

Advanced Framework Pro turns any mesh into a physical button with BPC_Interaction_Overlap, which fires when a fingertip enters a tagged collision. Add BPC_Interaction_Select next to it and the same button also works on desktop. By the end of this you will have a physical button the player can press with a fingertip in VR and click on desktop.

At a glance

Your actor
├─ Mesh
├─ Collision                  component tag "Press"
├─ BPC_Interaction_Overlap    Component Tag Of Collision = Press,
│                             Allowed Identifiers = fingertip identifier (empty = any)
└─ BPC_Interaction_Select     the same button on desktop
Events: Overlap Started, Release

Steps

  1. Create an actor with a mesh and a collision component. Tag the collision component, for example Press.
  2. Add a BPC_Interaction_Overlap component and set Component Tag Of Collision to that tag.
  3. Set Allowed Identifiers to the identifiers of the abilities that may press it, for example only the fingertip ability's. The list must not stay empty: an empty list accepts no ability.
  4. Bind to Overlap Started and Release.
  5. Add a BPC_Interaction_Select as well so the same button works on desktop.
Collision component tagged for overlap
howto_pressable_01.pngCollision component tagged for overlap
Collision component tagged for overlap
A fingertip on a button, the button visibly depressed
AFS_UX_Overlap_result.pngA fingertip on a button, the button visibly depressed
A fingertip on a button, the button visibly depressed

Notes

For a button that physically depresses, use BPC_Interaction_Overlap_Drag with a BPC_State_Drag component instead, and set Component Tag Of Drag Comp to point at it.