Jump to content

ViveInput.AddClick Can't get the callback of controller button event


Reply Lives Matter

Recommended Posts

As title.

I'm trying to get the callback from ViveInput.AddClick but it seem not working to me.

And the device I'm testing is oculus quest 2. 

Here is my testing code. controllerButtons is created by my own code it was a array of all enum of ControllerButton.

    private void Start()
    {
        var everyHandEvent = ControllerEventData.HandEvent.Everything;
        var controllerButtons = everyHandEvent.GetAllFlagBits().Cast<ControllerButton>().ToArray();
        HandRole[] everyHandRoles = new HandRole[]
        {
            HandRole.RightHand,
            HandRole.LeftHand,
            HandRole.ExternalCamera,
            HandRole.Controller3,
            HandRole.Controller4,
            HandRole.Controller5,
            HandRole.Controller6,
            HandRole.Controller7,
            HandRole.Controller8,
            HandRole.Controller9,
            HandRole.Controller10,
            HandRole.Controller11,
            HandRole.Controller12,
            HandRole.Controller13,
            HandRole.Controller14,
            HandRole.Controller15,
        };
        foreach (var handRole in everyHandRoles)
        {
            foreach (var button in controllerButtons)
            {
                ViveInput.AddPressDown(handRole, button, () => RuntimeDebug.Log($"HandRole={handRole},\r\nButton={button}"));
                ViveInput.AddPress(handRole, button, () => RuntimeDebug.Log($"HandRole={handRole},\r\nButton={button}"));
                ViveInput.AddPressUp(handRole, button, () => RuntimeDebug.Log($"HandRole={handRole},\r\nButton={button}"));
                ViveInput.AddClick(handRole, button, () => RuntimeDebug.Log($"HandRole={handRole},\r\nButton={button}"));
            }
        }
    }

 

Edited by Reply Lives Matter
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...