コード例 #1
0
 void Start()
 {
     //Start receiving input by the Control
     MLInput.Start();
     MLInput.OnControllerButtonDown += OnButtonDown;
     _controller = MLInput.GetController(MLInput.Hand.Left);
 }
コード例 #2
0
 // Start is called before the first frame update
 void Start()
 {
     MLInput.Start();
     controller = MLInput.GetController(MLInput.Hand.Left);
     UnSelectAll();
     up.SetActive(true);
 }
コード例 #3
0
        public static MLInput.Controller.ControlType determineControllerType(byte controllerId)
        {
            //
            // The first controller is considered the left handed controller, even though
            // we may hold the controller in our right hand :)
            //
            MLInput.Controller leftHandController  = MLInput.GetController(MLInput.Hand.Left);
            MLInput.Controller rightHandController = MLInput.GetController(MLInput.Hand.Right);

            bool isMobileAppLeft  = (leftHandController != null && leftHandController.Type == MLInput.Controller.ControlType.MobileApp);
            bool isMobileAppRight = (rightHandController != null && rightHandController.Type == MLInput.Controller.ControlType.MobileApp);

            bool isControllerLeft  = (leftHandController != null && leftHandController.Type == MLInput.Controller.ControlType.Control);
            bool isControllerRight = (rightHandController != null && rightHandController.Type == MLInput.Controller.ControlType.Control);

            bool isMobileApp  = (isMobileAppLeft || isMobileAppRight);
            bool isController = (isControllerLeft || isControllerRight);

            if (isMobileApp)
            {
                return(MLInput.Controller.ControlType.MobileApp);
            }
            if (isController)
            {
                return(MLInput.Controller.ControlType.Control);
            }
            return(MLInput.Controller.ControlType.None);
        }
コード例 #4
0
        /// <summary>
        /// Initialize variables, callbacks and check null references.
        /// </summary>
        void Start()
        {
            MLResult result = MLInput.Start();

            if (!result.IsOk)
            {
                Debug.LogError("Error ControllerTransform starting MLInput, disabling script.");
                enabled = false;
                return;
            }

            _camera = Camera.main;

            MLInputController controller = MLInput.GetController(_hand);

            if (controller != null && controller.Connected && ((uint)(controller.Type) & (uint)(_devices)) != 0)
            {
                _mlInputController = controller;
            }
            else
            {
                _mlInputController = null;
            }

            MLInput.OnControllerConnected    += HandleOnControllerConnected;
            MLInput.OnControllerDisconnected += HandleOnControllerDisconnected;
        }
コード例 #5
0
 void Awake()
 {
     MLInput.Start();
     MLInput.OnControllerButtonDown += OnButtonDown;
     MLInput.OnControllerButtonUp   += OnButtonUp;
     _controller = MLInput.GetController(MLInput.Hand.Left);
 }
コード例 #6
0
 // Start is called before the first frame update
 void Start()
 {
     MLInput.Start();
     //MLInput.OnControllerButtonDown += OnButtonDown;
     //MLInput.OnControllerButtonUp += OnButtonUp;
     controller = MLInput.GetController(MLInput.Hand.Left);
 }
コード例 #7
0
ファイル: Setup.cs プロジェクト: Sharkful/Maker-Space-AR-Tour
 // Start is called before the first frame update
 void Start()
 {
     MLInput.Start();
     controller = MLInput.GetController(MLInput.Hand.Left);
     controller.OnButtonDown += HandleButtonDown;
     currentMenu              = objectsToPlace[0];
 }
コード例 #8
0
        /// <summary>
        /// Validate variables
        /// </summary>
        void Start()
        {
            if (null == _visualizer)
            {
                Debug.LogError("MasterMaterialController._visualizer not set, disabling script");
                enabled = false;
                return;
            }

            _materialControllers = GetComponents <MaterialController>();
            if (_materialControllers.Length < 1)
            {
                Debug.LogError("MasterMaterialController._materialControllers is empty, disabling script.");
                enabled = false;
                return;
            }
            MLResult result = MLInput.Start();

            if (!result.IsOk)
            {
                Debug.LogError("Error MasterMaterialController starting MLInput, disabling script.");
                enabled = false;
                return;
            }

            _statusText.text              = "";
            _controller                   = MLInput.GetController(MLInput.Hand.Left);
            MLInput.OnControllerButtonUp += HandleOnButtonUp;
        }
コード例 #9
0
        private void HandleControlConnected(byte controlId)
        {
            //we just want to work with the control:
            MLInputController connectedControl = MLInput.GetController(controlId);

            switch (handedness)
            {
            case ControlHandedness.Any:
                Initialize(MLInput.GetController(controlId));
                break;

            case ControlHandedness.Left:
                if (connectedControl.Hand == MLInput.Hand.Left)
                {
                    Initialize(MLInput.GetController(controlId));
                }
                break;

            case ControlHandedness.Right:
                if (connectedControl.Hand == MLInput.Hand.Right)
                {
                    Initialize(MLInput.GetController(controlId));
                }
                break;
            }
        }
コード例 #10
0
 /// <summary>
 /// Handles the event for controller connected.
 /// Assign controller to connected controller if desired hand matches
 /// with new connected controller.
 /// </summary>
 /// <param name="controllerId"> The id of the controller. </param>
 private void HandleOnControllerConnected(byte controllerId)
 {
     if (_hand == MLInput.GetController(controllerId).Hand)
     {
         _mlInputController = MLInput.GetController(controllerId);
     }
 }
コード例 #11
0
ファイル: Screen.cs プロジェクト: euxcet/cloud
 // Use this for initialization
 void Start()
 {
     MLInput.Start();
     controller = MLInput.GetController(MLInput.Hand.Left);
     Debug.Log(controller.Position);
     Debug.Log(controller.Orientation);
 }
コード例 #12
0
        //Private Methods:
        private void GetControl()
        {
            for (int i = 0; i < 2; ++i)
            {
                MLInputController control = MLInput.GetController(i);
                if (control.Type == MLInputControllerType.Control)
                {
                    switch (handedness)
                    {
                    case ControlHandedness.Any:
                        Initialize(control);
                        break;

                    case ControlHandedness.Left:
                        if (control.Hand == MLInput.Hand.Left)
                        {
                            Initialize(control);
                        }
                        break;

                    case ControlHandedness.Right:
                        if (control.Hand == MLInput.Hand.Right)
                        {
                            Initialize(control);
                        }
                        break;
                    }
                }
            }
        }
コード例 #13
0
 void Start()
 {
     //Start receiving input by the Control
     MLInput.Start();
     _controller = MLInput.GetController(MLInput.Hand.Left);
     _renderer   = GetComponent <Renderer>();
 }
コード例 #14
0
        /// <summary>
        /// Initialize variables, callbacks and check null references.
        /// </summary>
        void Start()
        {
            MLResult result = MLInput.Start();

            if (!result.IsOk)
            {
                Debug.LogError("Error ControllerFeedbackExample starting MLInput, disabling script.");
                enabled = false;
                return;
            }

            MLInputController controller = MLInput.GetController(_hand);

            if (controller != null && controller.Connected && (controller.Type == MLInputControllerType.Control))
            {
                _mlInputController = controller;
            }
            else
            {
                _mlInputController = null;
            }

            MLInput.OnControllerConnected    += HandleOnControllerConnected;
            MLInput.OnControllerDisconnected += HandleOnControllerDisconnected;
            MLInput.OnControllerButtonUp     += HandleOnButtonUp;
            MLInput.OnControllerButtonDown   += HandleOnButtonDown;
            MLInput.OnTriggerDown            += HandleOnTriggerDown;
        }
コード例 #15
0
    void Awake()
    {
        MLInput.Start();
        MLInput.OnControllerButtonDown += OnButtonDown;
        MLInput.OnControllerButtonUp   += OnButtonUp;
        soldier.SetActive(false);

        _controller = MLInput.GetController(MLInput.Hand.Left);
        zoominDic.Add(CameraState.OverviewMain, CameraState.CloseUpMain);
        zoominDic.Add(CameraState.CloseUpMain, CameraState.FirstPersonMain);
        zoominDic.Add(CameraState.OverviewIslandOne, CameraState.CloseUpIslandOne);
        zoominDic.Add(CameraState.CloseUpIslandOne, CameraState.FirstPersonIslandOne);
        zoominDic.Add(CameraState.OverviewIslandTwo, CameraState.CloseUpIslandTwo);
        zoominDic.Add(CameraState.CloseUpIslandTwo, CameraState.FirstPersonIslandTwo);
        zoominDic.Add(CameraState.OverviewResIslandOne, CameraState.CloseUpResIslandOne);
        zoominDic.Add(CameraState.OverviewResIslandTwo, CameraState.CloseUpResIslandTwo);

        zoomoutDic.Add(CameraState.FirstPersonMain, CameraState.CloseUpMain);
        zoomoutDic.Add(CameraState.CloseUpMain, CameraState.OverviewMain);
        zoomoutDic.Add(CameraState.FirstPersonIslandOne, CameraState.CloseUpIslandOne);
        zoomoutDic.Add(CameraState.CloseUpIslandOne, CameraState.OverviewIslandOne);
        zoomoutDic.Add(CameraState.FirstPersonIslandTwo, CameraState.CloseUpIslandTwo);
        zoomoutDic.Add(CameraState.CloseUpIslandTwo, CameraState.OverviewIslandTwo);
        zoomoutDic.Add(CameraState.CloseUpResIslandOne, CameraState.OverviewResIslandOne);
        zoomoutDic.Add(CameraState.CloseUpResIslandTwo, CameraState.OverviewResIslandTwo);

        zoomoutReadyTM      = zoomoutReady.GetComponent <TextMeshPro>();
        zoomoutReadyTM.text = "Zoomout Ready";
        zoomoutReady.SetActive(false);
    }
コード例 #16
0
 void Awake()
 {
     MLInput.Start(); // to start receiving input from the controller
     // MLInput.OnControllerButtonDown += OnButtonDown; // set button down listener
     //MLInput.OnControllerButtonDown += OnButtonDown; // Bumper button
     _controller = MLInput.GetController(MLInput.Hand.Left);
 }
コード例 #17
0
 /// <summary>
 /// Handles the event for controller connected.
 /// </summary>
 /// <param name="controllerId"> The id of the controller. </param>
 private void HandleOnControllerConnected(byte controllerId)
 {
     // Type not available on OnControllerConnected, checking on update.
     if (_hand == MLInput.GetController(controllerId).Hand&& _mlInputController == null)
     {
         _mlInputController = MLInput.GetController(controllerId);
     }
 }
コード例 #18
0
 void Awake()
 {
     MLInput.Start();
     MLInput.OnControllerButtonDown += OnButtonDown;
     MLInput.OnControllerButtonUp   += OnButtonUp;
     _controller = MLInput.GetController(controllerHand);
     Debug.Log("Controller connected: " + _controller.ToString());
 }
コード例 #19
0
ファイル: scr.cs プロジェクト: Alan19/ThereminAR
 private void Start()
 {
     MLInput.Start();                                        // to start receiving input from the controller
     _controller = MLInput.GetController(MLInput.Hand.Left); //left or right it doesn’t really matter
     Debug.Log("Starting...");
     //MusicSource.Play();
     MusicSource.loop = true;
 }
コード例 #20
0
 private void HandleControllerConnected(byte controllerID)
 {
     if (controller == null)
     {
         controller = MLInput.GetController(controllerID);
         Debug.Log("ML controller with ID: " + controller.Id + " connected!");
     }
 }
コード例 #21
0
    private void Start()
    {
        _cube   = GameObject.Find("Cube");
        _camera = GameObject.Find("Main Camera");

        MLInput.Start();
        _controller = MLInput.GetController(MLInput.Hand.Left);
    }
コード例 #22
0
    // Start is called before the first frame update
    void Start()
    {
        MLInput.Start();
        _ctrl = MLInput.GetController(MLInput.Hand.Left);

        MLInput.OnTriggerDown += HandleOnTriggerDown;
        MLInput.OnTriggerUp   += HandleOnTriggerUp;
    }
コード例 #23
0
ファイル: sledSpawner.cs プロジェクト: MIT-RH-2/SledAR2
 // Start is called before the first frame update
 void Start()
 {
     MLInput.Start();
     MLInput.OnControllerButtonDown += OnButtonDown;
     MLInput.OnControllerButtonUp   += OnButtonUp;
     _controller = MLInput.GetController(MLInput.Hand.Left);
     sledBody    = sled.GetComponent <Rigidbody>();
 }
コード例 #24
0
    void Awake()
    {
        Debug.Log("AWAKE");

        MLInput.Start();
        MLInput.OnControllerButtonUp += OnButtonUp;
        _controller = MLInput.GetController(MLInput.Hand.Left);
    }
コード例 #25
0
 //Hitting home tap will go between calibration and not calibrating
 //When calibrating, bumper rotates the robot.
 //When not calibrating, bumper brings up/puts away menu.
 void Awake()
 {
     MLInput.Start();
     MLInput.OnControllerButtonDown += OnButtonDown;
     MLInput.OnControllerButtonUp   += OnButtonUp;
     _controller           = MLInput.GetController(MLInput.Hand.Left);
     lastMenuTimeChange    = DateTime.Now;
     lastTriggerTimeChange = DateTime.Now;
 }
コード例 #26
0
    private void Start()
    {
        //cube = GameObject.Find("Cube");
        _imgTarget = GameObject.Find("ImageTarget");
        _camera    = Camera.main.gameObject;

        MLInput.Start();
        _controller = MLInput.GetController(MLInput.Hand.Left);
    }
コード例 #27
0
ファイル: NextScene.cs プロジェクト: ageldert/MagicAcoustics
 void Start()
 {
     if (!MLInput.IsStarted)
     {
         MLInput.Start();
     }
     _controller          = MLInput.GetController(MLInput.Hand.Left);
     MLInput.OnTriggerUp += OnTriggerUp;
 }
コード例 #28
0
    // Start is called before the first frame update
    void Start()
    {
        MLInput.Start();

        _controllerConnectionHandler = this.gameObject.GetComponent <ControllerConnectionHandler>();
        //_controller = _controllerConnectionHandler.ConnectedController;
        _controller = MLInput.GetController(MLInput.Hand.Left);
        _controlLR  = GameObject.Find("Control LR").GetComponent <LineRenderer>();
    }
コード例 #29
0
    // Use this for initialization
    void Start()
    {
        MLInput.Start();
        MLInput.OnControllerButtonDown += OnButtonDown;
        MLInput.OnControllerButtonUp   += OnButtonUp;

        _MLInputController = MLInput.GetController(MLInput.Hand.Left);
        gameObject.SetActive(true);
    }
コード例 #30
0
/*
 * In our Awake() method, we link the GameObject to our Cube, we deactivate it and we start receiving some input by the Control.
 * A OnButtonDown method handles the MLInput.OnControllerButtonDown events that refer to the Bumper.
 */

    void Awake()
    {
        _cube = GameObject.Find("Cube");
        _cube.SetActive(true);
        MLInput.Start();
        MLInput.OnControllerButtonDown += OnButtonDown;
        MLInput.OnControllerButtonUp   += OnButtonUp;
        _controller = MLInput.GetController(MLInput.Hand.Left);
    }