Grab an object only while pressing and holding a controller button in VRTK v4

Di Weng
1 min readAug 19, 2019

To get rid of the grabbed object after the controller button is released:

Step 1. Find the button action
  1. Find the desired button action in “Scene/VRTK Setup/InputMappings/UnityXR.OpenVR.LeftController”
  2. Add a item for the “Deactivated” event
  3. Drag “LeftInteractor” from Hierarchy to Inspector to fill in “None (Object)”
  4. Choose “InteractorFacade/Ungrab ()” on the right
Step 2–4. Add an event handler

Thereafter you may repeat 1–4 for the right controller to achieve the same effect.

--

--

Di Weng

Urban Visual Analytics | PhD Candidate at State Key Lab of CAD&CG, Zhejiang University | Member of Interactive Data Group | https://dweng.org