void Start() { //Start receiving input by the Control MLInput.Start(); MLInput.OnControllerButtonDown += OnButtonDown; _controller = MLInput.GetController(MLInput.Hand.Left); }
// Start is called before the first frame update void Start() { MLInput.Start(); controller = MLInput.GetController(MLInput.Hand.Left); UnSelectAll(); up.SetActive(true); }
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); }
/// <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; }
void Awake() { MLInput.Start(); MLInput.OnControllerButtonDown += OnButtonDown; MLInput.OnControllerButtonUp += OnButtonUp; _controller = MLInput.GetController(MLInput.Hand.Left); }
// Start is called before the first frame update void Start() { MLInput.Start(); //MLInput.OnControllerButtonDown += OnButtonDown; //MLInput.OnControllerButtonUp += OnButtonUp; controller = MLInput.GetController(MLInput.Hand.Left); }
// Start is called before the first frame update void Start() { MLInput.Start(); controller = MLInput.GetController(MLInput.Hand.Left); controller.OnButtonDown += HandleButtonDown; currentMenu = objectsToPlace[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; }
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; } }
/// <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); } }
// Use this for initialization void Start() { MLInput.Start(); controller = MLInput.GetController(MLInput.Hand.Left); Debug.Log(controller.Position); Debug.Log(controller.Orientation); }
//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; } } } }
void Start() { //Start receiving input by the Control MLInput.Start(); _controller = MLInput.GetController(MLInput.Hand.Left); _renderer = GetComponent <Renderer>(); }
/// <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; }
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); }
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); }
/// <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); } }
void Awake() { MLInput.Start(); MLInput.OnControllerButtonDown += OnButtonDown; MLInput.OnControllerButtonUp += OnButtonUp; _controller = MLInput.GetController(controllerHand); Debug.Log("Controller connected: " + _controller.ToString()); }
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; }
private void HandleControllerConnected(byte controllerID) { if (controller == null) { controller = MLInput.GetController(controllerID); Debug.Log("ML controller with ID: " + controller.Id + " connected!"); } }
private void Start() { _cube = GameObject.Find("Cube"); _camera = GameObject.Find("Main Camera"); MLInput.Start(); _controller = MLInput.GetController(MLInput.Hand.Left); }
// Start is called before the first frame update void Start() { MLInput.Start(); _ctrl = MLInput.GetController(MLInput.Hand.Left); MLInput.OnTriggerDown += HandleOnTriggerDown; MLInput.OnTriggerUp += HandleOnTriggerUp; }
// 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>(); }
void Awake() { Debug.Log("AWAKE"); MLInput.Start(); MLInput.OnControllerButtonUp += OnButtonUp; _controller = MLInput.GetController(MLInput.Hand.Left); }
//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; }
private void Start() { //cube = GameObject.Find("Cube"); _imgTarget = GameObject.Find("ImageTarget"); _camera = Camera.main.gameObject; MLInput.Start(); _controller = MLInput.GetController(MLInput.Hand.Left); }
void Start() { if (!MLInput.IsStarted) { MLInput.Start(); } _controller = MLInput.GetController(MLInput.Hand.Left); MLInput.OnTriggerUp += OnTriggerUp; }
// 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>(); }
// Use this for initialization void Start() { MLInput.Start(); MLInput.OnControllerButtonDown += OnButtonDown; MLInput.OnControllerButtonUp += OnButtonUp; _MLInputController = MLInput.GetController(MLInput.Hand.Left); gameObject.SetActive(true); }
/* * 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); }