Change y position while holding a button on a VR controller

Currently my scene has the OVR Player Controller parented to a capsule, which I’m using for collision detection. I would like the player’s y position to increase while one of the Quest 2’s triggers are being held, specifically the secondary index trigger, but as I am still learning this stuff I’m unsure of how to go about doing this. Any help would be greatly appreciated.

Thanks in advance

Try something like this on the object you want to move

using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    [SerializeField] private float _speed = 1f;

    private void Update()
    {
        // Each frame we check whether either hand has the secondary index trigger pressed
        if (OVRInput.Get(OVRInput.Button.SecondaryIndexTrigger, OVRInput.Controller.LHand | OVRInput.Controller.RHand))
        {
            // if either is then we want to move upwards
            // how fast we move up is scaled by the _speed variable and the frame time
            transform.position += Vector3.up * (_speed * Time.deltaTime);
        }
    }
}