public override void Interact() { // pointToPlaneVectorTest /* * Vector3 nTest = new Vector3(1f, 1f, 0f); * Vector3 pvTest = new Vector3(2f, 2f, 0f); * * Vector3 pointTest = new Vector3(1f, 5f, 0f); * Vector3 pointTest2 = new Vector3(1f, 5f, 1f); * Vector3 pointTest3 = new Vector3(6f, 3f, 0f); * Vector3 pointTest4 = new Vector3(6f, 3f, 1f); * * Debug.Log(pointToPlaneVector(nTest, pvTest, pointTest).ToVector3f().ToString()); * Debug.Log(pointToPlaneVector(nTest, pvTest, pointTest2).ToVector3f().ToString()); * Debug.Log(pointToPlaneVector(nTest, pvTest, pointTest3).ToVector3f().ToString()); * Debug.Log(pointToPlaneVector(nTest, pvTest, pointTest4).ToVector3f().ToString()); */ initialPosition = transform.localPosition; initialRotation = transform.localRotation; initialFaceCenter = Extrudable._manifold.GetCenter(AssociatedFaceID); initialManifold = Extrudable._manifold.Copy(); selectedFaceList = GetAdjacentLockedFaces(AssociatedFaceID, new List <AdjacentLockedFaces>()); extrudingFaces = selectedFaceList.ConvertAll(pair => pair.faceid); ControlsManager.Instance.RemoveLatches(extrudingFaces); initialVertexPositions = ControlsManager.Instance.GetVertexPositionsFromFaces(extrudingFaces); isExtruding = false; var worldToLocal = transform.parent.worldToLocalMatrix; initialControllerPosInLocalSpace = worldToLocal.MultiplyPoint(_controllerCollider.transform.position); initialControllerOffset = initialControllerPosInLocalSpace - transform.localPosition; IsDragged = true; lastRotation = GetControllerRotationInLocalSpace(); firstRotation = lastRotation; angleSnap = true; translateSnap = true; ControlsManager.Instance.Extrudable.rebuild = true; if (extrudingFaces.Count > 1) { ControlsManager.Instance.DeleteControlsExceptSelectedFaces(new List <int> { AssociatedFaceID }); } else { //ControlsManager.Instance.DeleteControlsExceptSelectedFaces(extrudingFaces); //ControlsManager.Instance.DeleteControlsExceptFaces(initialManifold.GetAdjacentFaceIdsAndEdgeCenters(AssociatedFaceID).faceId, AssociatedFaceID); ControlsManager.Instance.DeleteControlsExceptFaces(new int[0], AssociatedFaceID); } ControlsManager.FireUndoStartEvent(mesh, this, initialPosition, initialRotation); }
public override void Interact() { //Debug.Log(AssociatedVertexID); interactingControllerCollider = _controllerCollider.transform; activeControllers.Add(this); //splitManifold = Extrudable._manifold.Copy(); initialManifold = Extrudable._manifold.Copy(); //Debug.Log(Extrudable._manifold.) adjacentVertices = AdjacentVertices(); if (activeControllers.Count == 1) { ChangeInteraction(InteractionMode.SINGLE); IsDragged = true; initialPosition = transform.localPosition; initialRotation = transform.localRotation; Vector3 controllerPosInLocalSpace = transform.parent.worldToLocalMatrix.MultiplyPoint(_controllerCollider.transform.position); initialControllerOffset = controllerPosInLocalSpace - transform.localPosition; ControlsManager.Instance.Extrudable.rebuild = true; ControlsManager.FireUndoStartEvent(mesh, this, initialPosition, initialRotation); if (ControlsManager.Instance.turntable) { minDeltaY = transform.parent.InverseTransformPoint(Vector3.one * ControlsManager.Instance.turntable.GetMaxYWithBounds()).y; } else { minDeltaY = -100f; } // Display two handed options } else if (activeControllers.Count == 2 && refinementActive && adjacentVertices.ContainsKey(activeControllers[0].AssociatedVertexID) && adjacentVertices.ContainsKey(activeControllers[1].AssociatedVertexID)) { activeControllers[0].ChangeInteraction(InteractionMode.DUAL); ChangeInteraction(InteractionMode.DUAL); Extrudable.MoveVertexTo(activeControllers[0].AssociatedVertexID, activeControllers[0].transform.localPosition); Extrudable.rebuild = true; initialRotation = transform.localRotation; AddEdgeBarSignifier(); } ControlsManager.Instance.DestroyFacesAndEdgeHandles(); }