//Runs every frame and handles the animation for the controllers when certain buttons are pressed.
void Update()
{
if (device.GetTouch(SteamVR_Controller.ButtonMask.Trigger))
{
SetAnimation("Grab", false, true);
}
if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger))
{
SetAnimation("Grab", true, false);
}
if (device.GetPressDown(SteamVR_Controller.ButtonMask.Grip))
{
SetAnimation("Pinch", false, true);
}
if (device.GetPressUp(SteamVR_Controller.ButtonMask.Grip))
{
SetAnimation("Pinch", true, false);
}
if (device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad))
{
Debug.Log("you touched the touchpad");
if (pointer != null)
{
pointer.SetActive(true);
}
}
if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad))
{
if (pointer != null)
{
pointer.SetActive(false);
}
}
}