//Init: private void Start() { //sets: _previousHand = handedness; //startup: if (!MLInput.IsStarted) { MLResult result = MLInput.Start(); if (!result.IsOk) { enabled = false; } } GetControl(); //hooks: MLInput.OnControllerConnected += HandleControlConnected; MLInput.OnControllerDisconnected += HandleControlDisconnected; }
void Start() { MLInput.Start(); camera = GameObject.FindWithTag("MainCamera"); _controller = MLInput.GetController(MLInput.Hand.Left); text = new string[4]; // text[0] = "default"; // text[1] = "default"; // text[2] = "default"; // text[3] = "default"; scn = SceneManager.GetActiveScene(); sceneName = scn.name; LogToFileHelper logger = new LogToFileHelper(); //establishing logger for storing interactions locally as a backup StartCoroutine(logger.LogToFileStringArray("log_touchpad.json", text)); //creating new session StartCoroutine(consoler.NewSession("http://" + LoggingConfig.ip_address + ":" + LoggingConfig.port + "/ext/" + LoggingConfig.api_key + "/new_session")); }
// Start is called before the first frame update void Start() { if (!MLInput.IsStarted) { MLResult inputStartResult = MLInput.Start(); switch (inputStartResult.Result) { case MLResult.Code.Ok: { print("ActsAsSwipeable -- started"); } break; case MLResult.Code.InvalidParam: throw new System.NotImplementedException(); case MLResult.Code.PrivilegeDenied: throw new System.NotImplementedException(); } } }
/// <summary> /// Try get controller reference. /// /// This is because "MLInput.OnControllerConnected" event won't invoke. /// I think why Zenject.IInitialize timing is too late to register an event. /// So this method try to get a reference cotroller at the initializing. /// </summary> private void TryGetController() { if (_inputController != null) { return; } if (!MLInput.IsStarted) { return; } MLResult result = MLInput.Start(); if (!result.IsOk) { return; } _inputController = MLInput.GetController(0); }
/// <inheritdoc /> public override void Enable() { if (!MLInput.IsStarted) { var config = new MLInputConfiguration(); var result = MLInput.Start(config); if (!result.IsOk) { Debug.LogError($"Error: failed starting MLInput: {result}"); return; } } if (!MLHands.IsStarted) { var result = MLHands.Start(); if (!result.IsOk) { Debug.LogError($"Error: failed starting MLHands: {result}"); return; } } for (byte i = 0; i < 3; i++) { // Currently no way to know what controllers are already connected. // Just guessing there could be no more than 3: Two Spatial Controllers and Mobile App Controller. var controller = GetController(i); if (controller != null) { MixedRealityToolkit.InputSystem?.RaiseSourceDetected(controller.InputSource, controller); } } MLInput.OnControllerConnected += OnControllerConnected; MLInput.OnControllerDisconnected += OnControllerDisconnected; MLInput.OnControllerButtonDown += MlInputOnControllerButtonDown; }
/// <summary> /// Validate all required components and sets event handlers. /// </summary> void Awake() { if (!MLInput.Start()) { Debug.LogError("Error RaycastExample starting MLInput, disabling script."); enabled = false; return; } if (_statusLabel == null) { Debug.LogError("Error RaycastExample._statusLabel is not set, disabling script."); enabled = false; return; } if (_raycastController == null) { Debug.LogError("Error RaycastExample._raycastController is not set, disabling script."); enabled = false; return; } if (_raycastHead == null) { Debug.LogError("Error RaycastExample._raycastHead is not set, disabling script."); enabled = false; return; } if (_raycastEyes == null) { Debug.LogError("Error RaycastExample._raycastEyes is not set, disabling script."); enabled = false; return; } MLInput.OnControllerButtonDown += OnButtonDown; UpdateRaycastMode(); }
/// <summary> /// Initialize MLInput, validate inputs, and register input event handler /// </summary> void Start() { if (!MLInput.Start()) { Debug.LogError("Error ImageTrackingExample starting MLInput, disabling script."); enabled = false; return; } if (_visualizers.Length < 1) { Debug.LogError("ImageTrackingExample._visualizers not set, disabling script."); enabled = false; return; } if (null == _statusLabel) { Debug.LogError("Error MeshingExample._statusLabel is not set, disabling script."); enabled = false; return; } MLInput.OnControllerButtonUp += HandleOnButtonUp; }
private void StartMLInput() { bool requestCFUID = true; if (!MLInput.IsStarted) { MLInputConfiguration config = new MLInputConfiguration(MLInputConfiguration.DEFAULT_TRIGGER_DOWN_THRESHOLD, MLInputConfiguration.DEFAULT_TRIGGER_UP_THRESHOLD, requestCFUID); MLResult result = MLInput.Start(config); if (!result.IsOk) { Debug.LogErrorFormat("Error: ControllerConnectionHandler failed starting MLInput, disabling script. Reason: {0}", result); return; } } MLInput.OnControllerConnected += HandleOnControllerConnected; MLInput.OnControllerDisconnected += HandleOnControllerDisconnected; MLInput.OnControllerButtonUp += HandleOnButtonUp; MLInput.OnControllerButtonDown += HandleOnButtonDown; }
//Init: private IEnumerator Start() { HideGUI(); //refs: _camera = Camera.main.transform; //sets: _cachedPrimaryWallGUIScale = selectPrimaryWallGUI.transform.localScale; //features: MLPersistentCoordinateFrames.Start(); MLPlanes.Start(); MLInput.Start(); //wait for service startup: Debug.Log("Waiting for PersistentCoordinateFrames service to localize..."); while (!MLPersistentCoordinateFrames.IsLocalized) { yield return(null); } Debug.Log("PersistentCoordinateFrames service localized!"); //hooks: MLPersistentCoordinateFrames.OnLocalized += HandleOnLocalized; MLPersistentCoordinateFrames.PCF.OnStatusChange += HandlePCFChanged; //requirements: _surfaceDetails = FindObjectOfType <SurfaceDetails>(); if (_surfaceDetails == null) { _surfaceDetails = gameObject.AddComponent <SurfaceDetails>(); } if (runAtStart) { Create(); } }
// Start is called before the first frame update void Start() { MLInput.Start(); MLInput.OnControllerButtonDown += OnButtonDown; //MLInput.OnControllerButtonUp += OnButtonUp; controller = MLInput.GetController(MLInput.Hand.Left); kill = 0; gates = Environment.instance.transform.GetChild(3);//0:Mapper 1:MapperNode 2:Origin 3:Gates totalGates = gates.childCount; //0:cylinder 1:Generattor 2:Hole 3:Collider foreach (Transform gate in gates) { gate.GetChild(3).gameObject.SetActive(false);//Colliderの消去 } gates.GetChild(0).GetChild(0).gameObject.SetActive(true); gates.GetChild(0).GetChild(1).gameObject.SetActive(true); gates.GetChild(0).GetChild(2).gameObject.SetActive(true); }
private void Start() { if (!MLInput.IsStarted) { MLInput.Configuration configuration = new MLInput.Configuration(enable6DOF) { EnableCFUIDTracking = enabledCFUIDTracking }; MLResult inputStartResult = MLInput.Start(configuration); switch (inputStartResult.Result) { case MLResult.Code.Ok: break; case MLResult.Code.InvalidParam: throw new System.NotImplementedException(); case MLResult.Code.PrivilegeDenied: throw new System.NotImplementedException(); } } }
private void StartMLInput() { bool requestCFUID = true; if (!MLInput.IsStarted) { MLInputConfiguration config = new MLInputConfiguration(MLInputConfiguration.DEFAULT_TRIGGER_DOWN_THRESHOLD, MLInputConfiguration.DEFAULT_TRIGGER_UP_THRESHOLD, requestCFUID); MLResult result = MLInput.Start(config); if (!result.IsOk) { Debug.LogErrorFormat("Error: ControllerConnectionHandler failed starting MLInput, disabling script. Reason: {0}", result); return; } else { // When using SDK 0.21.0+Unity2019.1.x // controllers might be already connected at this frame. // In that case the callback is never called. // That's why try to find connected controllers. var controller = MLInput.GetController(MLInput.Hand.Right) ?? MLInput.GetController(MLInput.Hand.Left); if (controller != null) { HandleOnControllerConnected(controller.Id); } } } MLInput.OnControllerConnected += HandleOnControllerConnected; MLInput.OnControllerDisconnected += HandleOnControllerDisconnected; MLInput.OnControllerButtonUp += HandleOnButtonUp; MLInput.OnControllerButtonDown += HandleOnButtonDown; }
void Start() { if (!MLInput.IsStarted) { MLResult inputStartResult = MLInput.Start(); switch (inputStartResult.Result) { case MLResult.Code.Ok: commonStart(); break; case MLResult.Code.InvalidParam: break; case MLResult.Code.PrivilegeDenied: default: break; } } else { commonStart(); } }
/// <summary> /// Once privileges have been granted, enable the camera and callbacks. /// </summary> private void EnableCapture() { if (!_hasStarted) { MLResult result = MLInput.Start(); if (!result.IsOk) { Debug.LogError("Failed to start MLInput on VideoCapture component. Disabling the script."); enabled = false; return; } if (!EnableMLCamera()) { Debug.LogError("MLCamera failed to connect. Disabling VideoCapture component."); enabled = false; return; } MLInput.OnControllerButtonDown += OnButtonDown; _hasStarted = true; } }
void Awake() { MLInput.Start(); MLInput.OnControllerButtonUp += OnButtonUp; }
/// <summary> /// Initializes component data, starts MLInput, validates parameters, initializes indicator states /// </summary> void Awake() { MLResult result = MLInput.Start(); if (!result.IsOk) { Debug.LogError("Error MCAExample starting MLInput, disabling script."); enabled = false; return; } if (_leftButtonHighlight == null) { Debug.LogError("Error MCAExample._moveButtonHighlight is not set, disabling script."); enabled = false; return; } if (_rightButtonHighlight == null) { Debug.LogError("Error MCAExample._appButtonHighlight is not set, disabling script."); enabled = false; return; } if (_homeTapIndicator == null) { Debug.LogError("Error MCAExample._homeTapIndicator is not set, disabling script."); enabled = false; return; } if (_touch1Indicator == null) { Debug.LogError("Error MCAExample._touch1Indicator is not set, disabling script."); enabled = false; return; } if (_touch2Indicator == null) { Debug.LogError("Error MCAExample._touch2Indicator is not set, disabling script."); enabled = false; return; } if (_keyboardText == null) { Debug.LogError("Error MCAExample._keyboardText is not set, disabling script."); enabled = false; return; } if (_modelRenderer == null) { Debug.LogError("Error MCAExample._modelRenderer is not set, disabling script."); enabled = false; return; } _leftButtonHighlight.SetActive(false); _rightButtonHighlight.SetActive(false); _homeTapIndicator.SetActive(false); _touch1Indicator.SetActive(false); _touch2Indicator.SetActive(false); _keyboardText.text = ""; _origColor = _modelRenderer.material.color; _controllerConnectionHandler = GetComponent <ControllerConnectionHandler>(); MLInput.OnControllerButtonDown += HandleOnButtonDown; MLInput.OnControllerButtonUp += HandleOnButtonUp; MLInput.OnTriggerDown += HandleOnTriggerDown; MLInput.OnTriggerUp += HandleOnTriggerUp; }
void Start() { MLInput.Start(); controller = MLInput.GetController(MLInput.Hand.Left); setTrigger = false; }
/// <summary> /// Initializes component data, starts MLInput, validates parameters, initializes indicator states /// </summary> void Awake() { if (!MLInput.Start().IsOk) { Debug.LogError("Error ControllerExample starting MLInput, disabling script."); enabled = false; return; } if (_leftButtonHighlight == null) { Debug.LogError("Error ControllerExample._moveButtonHighlight is not set, disabling script."); enabled = false; return; } if (_rightButtonHighlight == null) { Debug.LogError("Error ControllerExample._appButtonHighlight is not set, disabling script."); enabled = false; return; } if (_homeTapIndicator == null) { Debug.LogError("Error ControllerExample._homeTapIndicator is not set, disabling script."); enabled = false; return; } if (_touch1Indicator == null) { Debug.LogError("Error ControllerExample._touch1Indicator is not set, disabling script."); enabled = false; return; } if (_touch2Indicator == null) { Debug.LogError("Error ControllerExample._touch2Indicator is not set, disabling script."); enabled = false; return; } if (_keyboardText == null) { Debug.LogError("Error ControllerExample._keyboardText is not set, disabling script."); enabled = false; return; } if (_modelRenderer == null) { Debug.LogError("Error ControllerExample._modelRenderer is not set, disabling script."); enabled = false; return; } _leftButtonHighlight.SetActive(false); _rightButtonHighlight.SetActive(false); _homeTapIndicator.SetActive(false); _touch1Indicator.SetActive(false); _touch2Indicator.SetActive(false); _keyboardText.text = ""; _origColor = _modelRenderer.material.color; MLInputController controller = MLInput.GetController(_hand); _mlInputController = (controller != null && controller.Type == MLInputControllerType.MobileApp) ? controller : null; MLInput.OnControllerConnected += HandleOnControllerConnected; MLInput.OnControllerDisconnected += HandleOnControllerDisconnected; MLInput.OnControllerButtonDown += HandleOnButtonDown; MLInput.OnControllerButtonUp += HandleOnButtonUp; MLInput.OnTriggerDown += HandleOnTriggerDown; MLInput.OnTriggerUp += HandleOnTriggerUp; }
void Start() { MLInput.Start(); MLInput.OnTriggerDown += OnTriggerDown; }
void Start() { //Start receiving input by the Control MLInput.Start(); _controller = MLInput.GetController(MLInput.Hand.Left); }
void Awake() { MLInput.Start(); }
// Start is called before the first frame update void Start() { MLInput.Start(); //MLInput.OnControllerButtonDown += UpdateTriggerInfo; controller = MLInput.GetController(MLInput.Hand.Left); }
// Start is called before the first frame update void Start() { MLInput.Start(); _controller = MLInput.GetController(MLInput.Hand.Left); objMeshToExport = GameObject.Find("MeshingNodes"); }
private void Start() { MLInput.Start(); _controller = MLInput.GetController(MLInput.Hand.Left); //Doesn't matter if only 1 controller being used in this case }
/// <summary> /// Validate that all variables have been properly assigned and starts MLInput. /// </summary> /// <returns>True on success, False otherwise.</returns> private bool Initialization() { if (_statusIcon == null) { Debug.LogError("Error: WacomTabletExample._statusIcon is not set, disabling script."); return(false); } if (_statusText == null) { Debug.LogError("Error: WacomTabletExample._statusText is not set, disabling script."); return(false); } if (_informationText == null) { Debug.LogError("Error: WacomTabletExample._informationText is not set, disabling script."); return(false); } if (_instructionText == null) { Debug.LogError("Error: WacomTabletExample._instructionText is not set, disabling script."); return(false); } if (_defaultMaterial == null) { Debug.LogError("Error: WacomTabletExample._defaultMaterial is not set, disabling script."); return(false); } if (_activeMaterial == null) { Debug.LogError("Error: WacomTabletExample._activeMaterial is not set, disabling script."); return(false); } if (_buttonAssignment == null || _buttonAssignment.Length == 0) { Debug.LogError("Error: WacomTabletExample._buttonAssignment is not set, disabling script."); return(false); } if (_touchpadArrow == null) { Debug.LogError("Error: WacomTabletExample._touchpadArrow is not set, disabling script."); return(false); } // Obtain the reference for the touchpad arrow renderer. Renderer renderer = _touchpadArrow.GetComponent <Renderer>(); if (renderer == null) { Debug.LogErrorFormat("Error: WacomTabletExample._touchpadArrow does not have a renderer, disabling script."); return(false); } // Set the touchpad arrow material reference. _touchpadArrowMaterial = renderer.material; if (_pen == null) { Debug.LogError("Error: WacomTabletExample._pen is not set, disabling script."); return(false); } if (_brushTexture == null) { Debug.LogError("Error: WacomTabletExample._brushTexture is not set, disabling script."); return(false); } if (_brushMaterial == null) { Debug.LogError("Error: WacomTabletExample._brushMaterial is not set, disabling script."); return(false); } if (_eraseMaterial == null) { Debug.LogError("Error: WacomTabletExample._eraseMaterial is not set, disabling script."); return(false); } if (_canvasRenderer == null) { Debug.LogError("Error: WacomTabletExample._canvasRenderer is not set, disabling script."); return(false); } if (_colorWheel == null) { Debug.LogError("Error: WacomTabletExample._colorWheel is not set, disabling script."); return(false); } if (_colors == null || _colors.Length == 0) { Debug.LogError("Error: WacomTabletExample._colors is not set, disabling script."); return(false); } // Attempt to start the input service. MLResult result = MLInput.Start(); if (!result.IsOk) { Debug.LogErrorFormat("Error: WacomTabletExample failed starting MLInput, disabling script. Reason: {0}", result); return(false); } // Initialize and create the button dictionary. _deviceButtons = new Dictionary <MLInputTabletDeviceButton, List <Renderer> >(); for (int i = 0; i < _buttonAssignment.Length; i++) { // Only allow adding a key to the dictionary, if it doesn't exist. if (!_deviceButtons.ContainsKey(_buttonAssignment[i].Button)) { _deviceButtons.Add(_buttonAssignment[i].Button, _buttonAssignment[i].Renderers); } } return(true); }
/// <summary> /// Initialize variables, callbacks and check null references. /// </summary> void Start() { MLResult result = MLInput.Start(); if (!result.IsOk) { Debug.LogError("Error ControllerVisualizer starting MLInput, disabling script."); enabled = false; return; } if (!_controller) { Debug.LogError("Error ControllerVisualizer._controller not set, disabling script."); enabled = false; return; } if (!_trigger) { Debug.LogError("Error ControllerVisualizer._trigger not set, disabling script."); enabled = false; return; } if (!_touchpad) { Debug.LogError("Error ControllerVisualizer._touchpad not set, disabling script."); enabled = false; return; } if (!_homeButton) { Debug.LogError("Error ControllerVisualizer._homeButton not set, disabling script."); enabled = false; return; } if (!_bumperButton) { Debug.LogError("Error ControllerVisualizer._bumperButton not set, disabling script."); enabled = false; return; } if (!_touchIndicatorTransform) { Debug.LogError("Error ControllerVisualizer._touchIndicatorTransform not set, disabling script."); enabled = false; return; } MLInputController controller = MLInput.GetController(_hand); if (controller != null && controller.Connected && ((uint)(controller.Type) & (uint)(_devices)) != 0) { _mlInputController = controller; SetVisibility(true); } else { _mlInputController = null; SetVisibility(false); } MLInput.OnControllerConnected += HandleOnControllerConnected; MLInput.OnControllerDisconnected += HandleOnControllerDisconnected; MLInput.OnControllerButtonUp += HandleOnButtonUp; MLInput.OnControllerButtonDown += HandleOnButtonDown; _triggerMaterial = FindMaterial(_trigger); _touchpadMaterial = FindMaterial(_touchpad); _homeButtonMaterial = FindMaterial(_homeButton); _bumperButtonMaterial = FindMaterial(_bumperButton); // Calculate the radius of the touchpad's mesh Mesh mesh = _touchpad.GetComponent <MeshFilter>().mesh; _touchpadRadius = Vector3.Scale(mesh.bounds.extents, _touchpad.transform.lossyScale).x; }
/// <summary> /// Initializes all required components and data for this /// script to use during runtime. Also does error checking /// to make sure all required components have been enabled. /// </summary> private void Start() { _planes = gameObject.GetComponent <MLPlanesBehavior>(); _mainCamera = Camera.main; _type = SurfaceType.Floor; _isValid = false; _currentAngle = 0.0f; _firstPlacement = true; if (_planes == null) { Debug.LogError("MLPlanesBehavior component cannot be found when initializing PlanesPopulator. Disabling component."); this.enabled = false; return; } if (Cursor == null) { Debug.LogError("Cursor reference was not set when initializing PlanesPopulator. Disabling component."); this.enabled = false; return; } if (Cursor.raycast == null) { Debug.LogError("Cursor.raycast reference was not set when initializing PlanesPopulator. Disabling component."); this.enabled = false; return; } if (StatusLabel == null) { Debug.LogError("Status Label reference was not set when initializing PlanesPopulator. Disabling component."); this.enabled = false; return; } #if PLATFORM_LUMIN MLResult result = MLInput.Start(); if (!result.IsOk) { Debug.LogError("Controller reference was not set when initializing PlanesPopulator. Disabling component."); this.enabled = false; return; } #endif SortContent(); #if PLATFORM_LUMIN _controller = MLInput.GetController(MLInput.Hand.Left); MLInput.OnControllerButtonDown += HandleOnButtonPressed; #endif Cursor.raycast.OnRaycastResult += OnRaycastResult; Cursor.gameObject.SetActive(false); StatusLabel.gameObject.SetActive(false); }
private void Start() { MLInput.Start(); _controller = MLInput.GetController(MLInput.Hand.Left); }
// Start is called before the first frame update void Start() { MLInput.Start(); MLInput.OnControllerButtonDown += OnButtonDown; controller = MLInput.GetController(MLInput.Hand.Left); }
void Start() { InitSocket(); MLInput.Start(); controller = MLInput.GetController(MLInput.Hand.Left); }