Buy the hand on assetstore: https://assetstore.unity.com/packages...
And source code for the Update loop (this assumes you've setup a link to your AnimationController already).
PS: I might do these "properly" and re-animate the hands myself so they fit perfectly. If so I'll post something on the asset store (and will do a bunch of different assets so you can import any of them). But it takes a while so ...
NB: YouTube blocks the video if there are "angle brackets" anywhere, which is pathetic. So you'll have to re-instate the ones I was required to delete. Sigh.
PPS: apologies for poor mic - the foam got torn off and I haven't replaced it yet.
public void Update()
{
var handedControllers = new List[UnityEngine.XR.InputDevice]();
var desiredCharacteristics = UnityEngine.XR.InputDeviceCharacteristics.HeldInHand | UnityEngine.XR.InputDeviceCharacteristics.Right | UnityEngine.XR.InputDeviceCharacteristics.Controller;
UnityEngine.XR.InputDevices.GetDevicesWithCharacteristics(desiredCharacteristics, handedControllers);
InputDevice device = handedControllers[0];
bool isTouchingTrigger = false; // TODO: currently unsupported by Unity's XRInput toolkit
float triggerFingerAnimMinSqueezeValue = isTouchingTrigger ? 0f : 0.2f;
float triggerFingerAnimFullSqueezeValue = isTouchingTrigger ? 0f : 0.268f;
if( device.TryGetFeatureValue(CommonUsages.trigger, out float amount_Trigger) )
controller.IndexPercentage = Mathf.Lerp(triggerFingerAnimMinSqueezeValue, triggerFingerAnimFullSqueezeValue, amount_Trigger);
else
controller.IndexPercentage = triggerFingerAnimMinSqueezeValue;
/** Squeeze the thumb if any button is pressed or joystick moved */
bool thumbDown = false;
if( device.TryGetFeatureValue(CommonUsages.primary2DAxis, out Vector2 joystickMoved) )
thumbDown |= joystickMoved.magnitude ) 0.01f;
if( device.TryGetFeatureValue(CommonUsages.primaryButton, out bool primaryPressed) )
thumbDown |= primaryPressed;
if( device.TryGetFeatureValue(CommonUsages.secondaryButton, out bool secondaryPressed) )
thumbDown |= secondaryPressed;
if( thumbDown )
controller.ThumbPercentage = 0.407f;
else
controller.ThumbPercentage = 0;
}