private void ToggleTool(HandGestureState currentState, HandGestureState previousState, bool right) { if (currentState == HandGestureState.DragSelection) { if (right) { rightStartingPoint.position = _rightControllerMarker.transform.position + _hand2HUDOffset; rightStartingPoint.rotation = _rightControllerMarker.transform.rotation; rightCurrentPositionMarker.position = _rightControllerMarker.transform.position + _hand2HUDOffset; rightCurrentPositionMarker.rotation = _rightControllerMarker.transform.rotation; rightStickActive = true; AtomicSelection.Instance.BeginTransformation(true); } else { leftStartingPoint.position = _leftControllerMarker.transform.position + _hand2HUDOffset; leftStartingPoint.rotation = _leftControllerMarker.transform.rotation; leftCurrentPositionMarker.position = _leftControllerMarker.transform.position + _hand2HUDOffset; leftCurrentPositionMarker.rotation = _leftControllerMarker.transform.rotation; leftStickActive = true; AtomicSelection.Instance.BeginTransformation(false); } ToggleTranslateToolVisibility(true, right); ToggleTranslateToolColliders(true, right); BeginTranslationDrag?.Invoke((right) ? Hand.Right : Hand.Left); Debug.Log("begin drag"); } else if (previousState == HandGestureState.DragSelection && currentState != HandGestureState.DragSelection) { ToggleTranslateToolVisibility(false, right); ToggleTranslateToolColliders(false, right); if (right) { rightLineRenderer.SetPositions(new Vector3[] { Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero }); rightStickActive = false; AtomicSelection.Instance.CompleteTransformation(true); } else { leftLineRenderer.SetPositions(new Vector3[] { Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero }); leftStickActive = false; AtomicSelection.Instance.CompleteTransformation(false); } EndTranslationDrag?.Invoke((right) ? Hand.Right : Hand.Left); Debug.Log("end drag"); } }
private void DisengageTranslationTool(bool right) { ToggleTranslateToolVisibility(false, right); ToggleTranslateToolColliders(false, right); if (right) { rightLineRenderer.SetPositions(new Vector3[] { Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero }); rightStickActive = false; AtomicSelection.Instance.CompleteTransformation(true); } else { leftLineRenderer.SetPositions(new Vector3[] { Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero }); leftStickActive = false; AtomicSelection.Instance.CompleteTransformation(false); } EndTranslationDrag?.Invoke((right) ? Hand.Right : Hand.Left); ADM.QLog("end drag"); }