How to grab with the trigger as well as the grip button in VR
In Advanced Framework Pro the grip button grabs by default. Players who reach for the trigger instead can be given both: you add the trigger to the grab input and take it out of the context that passes buttons to held objects. Everything happens in copies of four input mapping contexts, so the framework itself stays untouched. By the end of this either button picks an object up, and letting go of that button drops it.
At a glance
Your copies of AFS_UX_Grip/Input/VR
├─ IMC_VR_Hand_Grab_Default_Left / _Right + IA_VR_Grab_* ← (L)/(R) Trigger keys
└─ IMC_VR_Grabbed_ButtonForward_Left / _Right − IA_VR_ButtonForward_Trigger_* Trigger rows
(keep the TriggerAxis rows)
Motion controller Blueprint › BPC_ControllerAbility_Hand_Grab
├─ Mapping Contexts Default = your two grab copies
└─ Mapping Contexts ButtonForward = your two ButtonForward copies
Result: grip or trigger grabs; releasing the button you grabbed with lets go
Steps
- In the Content Browser, open
AdvancedFrameworkPro/AFS_UX_Grip/Input/VRand copy four mapping contexts into a folder of your own:IMC_VR_Hand_Grab_Default_Leftand_Right,IMC_VR_Grabbed_ButtonForward_Leftand_Right. - Open your copy of
IMC_VR_Hand_Grab_Default_Right. Click + next to Mappings, pickIA_VR_Grab_Rightas the action, and in the key selector pick Oculus Touch (R) Trigger. Add Valve Index (R) Trigger and Vive (R) Trigger the same way if you support those controllers. The keys go into the mapping context; the input action itself stays untouched. - Do the same in your
IMC_VR_Hand_Grab_Default_Leftcopy withIA_VR_Grab_Leftand the (L) keys. Save both. - Open your copy of
IMC_VR_Grabbed_ButtonForward_Rightand delete the rows that mapIA_VR_ButtonForward_Trigger_Rightto a trigger key. Leave the Trigger Axis rows alone. Do the same in the Left copy and save both. - Open the motion controller Blueprints that carry the hand grab ability,
BPC_ControllerAbility_Hand_Grab. In the examples these areBP_MotionController_Hands_Left_Showroomand_Right_Showroom. - Select the ability component and set Mapping Contexts Default to your two grab copies and Mapping Contexts ButtonForward to your two ButtonForward copies. Compile and save both sides.
Notes
Why step 4 matters. While a hand holds something, the framework adds IMC_VR_Grabbed_ButtonForward,
which passes button presses on to the held object. It also listens to the trigger and consumes it. Without
step 4 the trigger goes to the held object as soon as you grab, so the grab never sees you let go: the
trigger works once, and only the grip can release.
Objects that use the trigger themselves, like the example pistol, do not mix well with trigger-grab: releasing the trigger after a shot would drop them. Keep them on grip, or keep the trigger in their ButtonForward context.
An AI assistant connected to the editor can make these changes for you; see Working with AI assistants.