We started creating an app for HTC Vive without using VRTK initially. Recently we switched over to using VRTK and ran into a problem where we want to do some actions when one controller is holding the trigger and the other is pressing another button. How do we achieve this using VRTK? Our current code:
controllerMain = SteamVR_Controller.Input((int)trackedObj.index);
controllerSecondary = SteamVR_Controller.Input(SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.Leftmost));
// In Update()
if (controllerMain.GetPressDown(triggerButton) && controllerSecondary.GetPressDown(triggerButton))
{
scaleSelected(gameObj); //enlarges selected GameObject based on distance between controllers
}
if (controllerMain.GetPressDown(triggerButton) && controllerSecondary.GetPressDown(gripButton))
{
deleteObject(gameObj); //delete selected GameObject
}
I couldn't find any examples where both controllers are used to interact with the same object in the VRTK docs. In the docs/examples, everything is event based while our code is not and there are no examples of actions with both controllers. How do we achieve similar behavior?
EDIT- VRTK