/// <summary> /// Handles the event for trigger down. /// </summary> /// <param name="controllerId">The id of the controller.</param> /// <param name="triggerValue">The value of the trigger.</param> private void HandleTriggerDown(byte controllerId, float triggerValue) { if (MLImageTracker.IsStarted && _controllerConnectionHandler.IsControllerValid(controllerId)) { RaycastHit hit; if (Physics.Raycast(controllerObject.transform.position, controllerObject.transform.forward, out hit, 10)) { DirectorMenuButton button = hit.transform.GetComponent <DirectorMenuButton>(); if (button != null) { if (button.OnControllerTriggerDown != null) { button.OnControllerTriggerDown(1.0f, button.PrefabID); } grabinGameObject = Instantiate(prefabs[button.PrefabID]); grabinGameObject.transform.parent = controllerObject.transform; grabinGameObject.transform.localPosition = new Vector3(0.0f, 0.0f, 0.75f); grabinGameObject.AddComponent <MoveableObject>(); DirectorManager.AddObject(grabinGameObject, button.PrefabID); } else if (hit.transform.GetComponent <MoveableObject>()) { grabinGameObject = hit.transform.gameObject; grabinGameObject.transform.parent = controllerObject.transform; grabinGameObject.transform.localPosition = new Vector3(0.0f, 0.0f, 0.75f); } } _isGrabbing = true; } }