/ Forums
Applications are now open to attend this year's Oculus Connect. Join us October 11–12 and be first in line for an inside look at what’s new and next for VR.

New To The Forum? Click Here To Read The How To Guide. -- Developers Click Here.

Button Touch State and/or Custom finger poses added to default localAvatar

chololenschololens Posts: 4
Virtual Boy (or Girl)
Hi,

I am trying to find a way to get the "button touch state" in Unity of the touch controller through code. Right now I am only seeing this available in the PC SDK section. Can someone help me out here, I would like to make custom finger poses based on whether that value is null or not?

If getting the touch controllers button touch state is only available in C++ is there a way for me to ad my custom finger poses to the already default ones without disabling those? Right now a solution I had was to use the animation tool in conjunction with the grip pose scene and save those alterations out to the animator and call those animations out in script based on button presses. However this is disabling the default animations, from what I can see, when you add this to the local avatar custom pose slot.

Any help would be appreciated.

Thanks!

Comments

  • chololenschololens Posts: 4
    Virtual Boy (or Girl)
    A little update. You can toggle between the default hand gestures and custom poses without having the custom pose slot override the default ones by adding a restriction in the OvrAvatar script under the Void UpdateCustomPoses() method. In there change this 
    if (sdkAvatar != IntPtr.Zero)
            {
               
                {
                    if (cachedLeftHandCustomPose != null && UpdateTransforms(cachedLeftHandJoints, cachedLeftHandTransforms))
                    {
                        CAPI.ovrAvatar_SetLeftHandCustomGesture(sdkAvatar, (uint)cachedLeftHandTransforms.Length, cachedLeftHandTransforms);
                    }
                }
    to something like this for example

    if (sdkAvatar != IntPtr.Zero)
            {
                if (Input.GetKeyDown(KeyCode.A))
                {
                    if (cachedLeftHandCustomPose != null && UpdateTransforms(cachedLeftHandJoints, cachedLeftHandTransforms))
                    {
                        CAPI.ovrAvatar_SetLeftHandCustomGesture(sdkAvatar, (uint)cachedLeftHandTransforms.Length, cachedLeftHandTransforms);
                    }
                }
     


  • juanoldinhojuanoldinho Posts: 83 Oculus Staff
    Hi,

    You can refer to our documentation using OVRInput which is available with the Oculus Utilities for Unity:

    https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovrinput/#unity-ovrinput-usage

    In particular see the section 'Button, Touch, and Near Touch'. You can use 
    OVRInput.Get(OVRInput.Button.One); 
    Which will return true of the 'A' button of the Touch controller is pressed.

    You can also refer to the OVRInput API for more methods to access to the other buttons, thumbsticks and triggers of the Touch controller.

    https://developer3.oculus.com/doc/1.16-unity/class_o_v_r_input.html
     


Sign In or Register to comment.