Exemplo n.º 1
0
        protected virtual T[] GetButtonArray(TBInput.Button button, ref TBInput.Controller controller)
        {
            if (controller == TBInput.Controller.Active)
            {
                controller = TBInput.GetActiveController();
            }

            return(TBInput.GetRawButtons <T>(button, GetButtonLookupTableForController(controller)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Needed for generating a controller type compatible with Oculus SDK calls.
        /// </summary>
        /// <param name="controller"></param>
        /// <returns></returns>
        public static OVRInput.Controller GetOculusControllerID(TBInput.Controller controller)
        {
            if (controller == TBInput.Controller.Active)
            {
                controller = TBInput.GetActiveController();
            }

            switch (controller)
            {
            case TBInput.Controller.LHandController:
                return(OVRInput.Controller.LTouch);

            case TBInput.Controller.RHandController:
                return(OVRInput.Controller.RTouch);

            case TBInput.Controller.Mobile3DOFController:
                if (TBCore.UsingEditorMode() || TBCore.GetActivePlatform() == VRPlatform.OculusPC)
                {
                    if (TBSettings.GetControlSettings().handedness3DOF == TBSettings.TBHardwareHandedness.Left)
                    {
                        return(OVRInput.Controller.LTouch);
                    }
                    else
                    {
                        return(OVRInput.Controller.RTouch);
                    }
                }
                else
                {
                    if (OVRInput.IsControllerConnected(OVRInput.Controller.LTrackedRemote))
                    {
                        return(OVRInput.Controller.LTrackedRemote);
                    }
                    else
                    {
                        return(OVRInput.Controller.RTrackedRemote);
                    }
                }

            case TBInput.Controller.ClickRemote:
                if (TBCore.GetActivePlatform() == VRPlatform.OculusMobile)
                {
                    return(OVRInput.Controller.Touchpad);
                }
                else
                {
                    return(OVRInput.Controller.Remote);
                }

            case TBInput.Controller.Gamepad:
                return(OVRInput.Controller.Gamepad);
            }

            TBLogging.LogError("Controller type " + controller + " has no match for Oculus.");
            return(OVRInput.Controller.None);
        }
Exemplo n.º 3
0
        protected GvrControllerInputDevice GetGoogleControllerID(TBInput.Controller controller)
        {
            if (controller == TBInput.Controller.Active)
            {
                controller = TBInput.GetActiveController();
            }

            switch (controller)
            {
            case TBInput.Controller.LHandController:
                return(GvrControllerInput.GetDevice(GvrControllerHand.Left));

            case TBInput.Controller.RHandController:
                return(GvrControllerInput.GetDevice(GvrControllerHand.Right));

            case TBInput.Controller.Mobile3DOFController:
                return(GvrControllerInput.GetDevice(GvrControllerHand.Dominant));

            default:
                TBLogging.LogError("No controller for " + controller + " exists in TButt's Google VR implementation. Falling back to dominant hand controller.");
                return(GvrControllerInput.GetDevice(GvrControllerHand.Dominant));
            }
        }