private void UpdateComplexCut(Vector2D pos) { if (Input.GetMouseButtonDown(0)) { complexSlicerPointsList.Clear(); complexSlicerPointsList.Add(pos); mouseDown = true; startedSlice = false; } if (complexSlicerPointsList.Count < 1) { return; } if (Input.GetMouseButton(0)) { Vector2D posMove = new Vector2D(complexSlicerPointsList.Last()); bool added = false; while ((Vector2D.Distance(posMove, pos) > minVertsDistance * visualScale)) { float direction = Vector2D.Atan2(pos, posMove); posMove.Push(direction, minVertsDistance * visualScale); if (startSliceIfPossible == true && startedSlice == false) { if (InSlicerComponents(new Vector2D(posMove))) { while (complexSlicerPointsList.Count > 2) { complexSlicerPointsList.RemoveAt(0); } startedSlice = true; } } complexSlicerPointsList.Add(new Vector2D(posMove)); added = true; } if (endSliceIfPossible == true && added) { if (ComplexSlice(complexSlicerPointsList) == true) { mouseDown = false; complexSlicerPointsList.Clear(); } } } if (mouseDown == true && Input.GetMouseButton(0) == false) { mouseDown = false; startedSlice = false; Slicer2D.ComplexCutSliceAll(complexCutLine, sliceLayer); complexSlicerPointsList.Clear(); } }
public void Update(Vector2D pos) { float scroll = Input.GetAxis("Mouse ScrollWheel"); float newCutSize = cutSize + scroll; if (newCutSize > 0.05f) { cutSize = newCutSize; } if (input.GetInputClicked()) { pointsList.Clear(); pointsList.Add(pos); } if (pointsList.Count < 1) { return; } if (input.GetInputHolding()) { Vector2D posMove = pointsList.Last().Copy(); int loopCount = 0; while ((Vector2D.Distance(posMove, pos) > minVertexDistance * visuals.visualScale)) { float direction = (float)Vector2D.Atan2(pos, posMove); posMove.Push(direction, minVertexDistance * visuals.visualScale); pointsList.Add(posMove.Copy()); loopCount++; if (loopCount > 150) { break; } } } if (input.GetInputReleased()) { ComplexCut complexCutLine = ComplexCut.Create(GetList(), cutSize * visuals.visualScale); Slicer2D.ComplexCutSliceAll(complexCutLine, sliceLayer); pointsList.Clear(); } }
private void UpdateComplexCut(Vector2D pos) { if (Input.GetMouseButtonDown(0)) { pointsList.Clear(); pointsList.Add(pos); mouseDown = true; } if (pointsList.Count < 1) { return; } if (Input.GetMouseButton(0)) { Vector2D posMove = pointsList.Last().Copy(); int loopCount = 0; while ((Vector2D.Distance(posMove, pos) > minVertexDistance * visualScale)) { float direction = (float)Vector2D.Atan2(pos, posMove); posMove.Push(direction, minVertexDistance * visualScale); pointsList.Add(posMove.Copy()); loopCount++; if (loopCount > 150) { break; } } } if (mouseDown == true && Input.GetMouseButton(0) == false) { ComplexCut complexCutLine = ComplexCut.Create(pointsList, cutSize * visualScale); Slicer2D.ComplexCutSliceAll(complexCutLine, sliceLayer); pointsList.Clear(); mouseDown = false; } }