/// <summary>
 /// Creates a new <see cref="GearVRTrackedControllerProxy"/> for the specified avatar and controller type.
 /// </summary>
 /// <param name="avatar">The avatar that owns the controller.</param>
 /// <param name="controllerType">The controller type the proxy wraps.</param>
 public GearVRTrackedControllerProxy(IVRAvatar avatar, VRAvatarLimbType limbType)
 {
     mAvatar          = avatar;
     mAvatarTransform = mAvatar.Transform;
     mHeadTransform   = mAvatar.Head.Transform;
     mLimbType        = limbType;
 }
예제 #2
0
        private void TrySetHandActive(VRAvatarLimbType limbType)
        {
            var isLimbConnected = OVRUtils.IsLimbConnected(limbType);
            var limb            = mAvatar.GetLimb(limbType);

            limb.SetActive(isLimbConnected);
        }
예제 #3
0
    /// <summary>
    /// OVRInput.Controller will return it as an enum and not a mask.
    /// </summary>
    /// <param name="limbType"></param>
    /// <returns></returns>
    public static OVRInput.Controller GetControllerType(VRAvatarLimbType limbType)
    {
        switch (limbType)
        {
        case VRAvatarLimbType.LeftHand:
            return(IsOculusQuest ? OVRInput.Controller.LTouch : OVRInput.Controller.LTrackedRemote);

        case VRAvatarLimbType.RightHand:
            return(IsOculusQuest ? OVRInput.Controller.RTouch : OVRInput.Controller.RTrackedRemote);

        default:
            return(OVRInput.Controller.None);
        }
    }
        public UnityXRTrackedControllerProxy(IVRAvatar avatar, VRAvatarLimbType limbType)
        {
            mAvatar          = avatar;
            mAvatarTransform = mAvatar.Transform;
            mHeadTransform   = mAvatar.Head.Transform;
            mLimbType        = limbType;

            if (TryGetXRNode(out XRNode outNode))
            {
                mInputDevice = InputDevices.GetDeviceAtXRNode(outNode);

                if (!mInputDevice.isValid)
                {
                    Debug.LogError($"No valid input device for {limbType}");
                    //throw new System.Exception($"No valid input device for {limbType}");
                }
            }
        }
예제 #5
0
    public static bool IsLimbConnected(VRAvatarLimbType limbType)
    {
        var type = GetControllerType(limbType);

        return(OVRInput.IsControllerConnected(type));
    }