So on a previous version of SteamVR I was able to use the following code to have the triggers initiate a function on a different item, but this no longer seems to work on the latest version of SteamVR. Is there a new code that I should be using? Also, is there a code to have the controller vibrate for a moment? Is there any documentation that shows how to program to the Vive controller?
I just tested your code out using the lasted Steam VR plugin from the Asset Store with Unity 5.3.4 and it seems to work just fine for me.
Regarding having the controller vibrate, this will activate the vibration while the trigger button is being pressed:
if(controller.GetPress(TriggerButton))
{
controller.TriggerHapticPulse(1000);
}
One of the things I found lacking at the moment is robust documentation regarding use of the Vive Controllers. However, I learned quite a bit from looking at the scenes in the Steam VR Extras folder.
Even the Steam VR extras flder has nothing on pressing the Trigger to get trigger pressure depth
The GetPress doesn’t seems to work well here. I advise :
Vector2 triggerPosition = device.GetAxis(EVRButtonId.k_EButton_SteamVR_Trigger);
bool triggerClicked = triggerPosition.x > 0.96f; // trigger treshold seems to be 0.9f
device being you SteaVR_Controller object
and I use 0.96 instead 0.9 or it tends to trigger before the click
I didn’t find a “cleaner” version 'til now
edit : 0.96 seems even much better, I’d make to tool in the options of my prototype for eventual problematic triggers