private void grabbingPoint(Transform point, ConstraintGrabbable grabber) { Vector3 newLoc = Vector3.zero; if (FixedPlane && presentline.forwardPlane.GetComponent <MeshRenderer>().enabled) { newLoc = Vector3.ProjectOnPlane(grabber.lastLocalPos - presentline.centerPt.localPosition, presentline.lookAtPlaneTarget.localPosition - presentline.plane.localPosition); newLoc = newLoc + presentline.centerPt.localPosition; if (newLoc.x > 10 || newLoc.x < -10 || newLoc.y > 10 || newLoc.y < -10 || newLoc.z > 10 || newLoc.z < -10) { grabber.transform.position = point.position; } point.localPosition = newLoc; } else { FixedPlane = false; lockButton.LockOff(); newLoc = grabber.lastLocalPos; point.localPosition = newLoc; } ptManager.updatePoint(point.name, presentline.UnscaledPoint(newLoc), FixedPlane); }
public void HandleInput(GameObject button) { print(button.name + " fired"); #region switch switch (button.name) { default: currExpression.tokens.Insert(index, button.name); index++; ptManager.inputReceived = true; break; //case "xShortCut" || "yShortCut": // shortCutManager(buttonID); // break; case "yShortCut": /// TODO: WHY??? Debug.Log("xSHORT CUT FIRED!!!!!!!!!!!!!!"); ptManager.updatePoint("pt2", new Vector3(1, 0, 0), false); // first axis setLine(); ptManager.inputReceived = true; break; case "xShortCut": /// TODO: WHY??? Debug.Log("ySHORT CUT FIRED!!!!!!!!!!!!!!"); ptManager.updatePoint("pt2", new Vector3(0, 1, 0), false); // first axis setLine(); ptManager.inputReceived = true; break; case "zShortCut": Debug.Log("zSHORT CUT FIRED!!!!!!!!!!!!!!"); ptManager.updatePoint("pt2", new Vector3(0, 0, 1), false); // first axis setLine(); ptManager.inputReceived = true; break; case "xyShortCut": ptManager.updatePoint("pt2", new Vector3(0, 1, 0), false); // first axis setPlane(); ptManager.updatePoint("pt3", new Vector3(1, 0, 0), false); // second axis ptManager.inputReceived = true; break; case "yzShortCut": /// TODO: WHY??? ptManager.updatePoint("pt2", new Vector3(1, 0, 0), false); // first axis setPlane(); ptManager.updatePoint("pt3", new Vector3(0, 0, 1), false); // second axis ptManager.inputReceived = true; break; case "xzShortCut": /// TODO: WHY??? ptManager.updatePoint("pt2", new Vector3(0, 1, 0), false); // first axis setPlane(); ptManager.updatePoint("pt3", new Vector3(0, 0, 1), false); // second axis ptManager.inputReceived = true; // presentline. break; case "ProjPlane": Debug.Log("PROJPLANE FIRED!!!!!!!!!!!!!!"); //ptManager.updatePoint("pt2", new Vector3(1, 1, 1), false); // first axis setPlane(); //here the plane is not resetting, the point is internally staying there probably and the not actually updating the plane //call plane or disable plane? //also the line's center point becomes odd. ptManager.inputReceived = true; break; case "ProjLine": Debug.Log("LINE FIRED!!!!!!!!!!!!!!"); //ptManager.updatePoint("pt2", new Vector3(1, 1, 1), false); // first axis //lineCover.GetComponent<MeshRenderer>().enabled = false; setLine(); ptManager.inputReceived = true; break; case "Paste": /* * string temp = GUIUtility.systemCopyBuffer; * List<string> tempList = ExpressionParser.Parse(temp); * currExpression.tokens.InsertRange(index, tempList); * index += tempList.Count; * calcManager.inputReceived = true; */ break; #region control_buttons case "Button_del": if (index > 0) { currExpression.tokens.RemoveAt(index - 1); index--; ptManager.inputReceived = true; } break; case "Button_Clear": index = 0; currExpression.tokens.Clear(); ptManager.inputReceived = true; break; case "Button_Enter": ptManager.inputReceived = true; break; case "Button_left": index--; if (index < 0) { index = 0; } break; case "Button_right": index++; if (index > currExpression.tokens.Count) { index = currExpression.tokens.Count; } break; case "Button_start": index = 0; break; case "Button_end": index = currExpression.tokens.Count; break; #endregion } #endregion ptManager.updateText = true; }