/// keyCode ここまで void NodeDragging() { float minDist = (MouseDragVec - DraggedNodeStartPosition).magnitude; //int minNodeId = DraggedNode.ID; for (int n = 0; n < thisKnot.AllNodes.Length; n++) { Node nd = thisKnot.AllNodes[n]; if (nd.ID != DraggedNode.ID) { float dist = (MouseDragVec - nd.Position).magnitude; if (dist < minDist) { return; } } } // ドラッグされたBeadの座標を変える。 DraggedNode.ThisBead.Position = MouseDragVec; // Nodeの座標も同期する DraggedNode.Position = MouseDragVec; //Debug.Log("mousePosition"+ MouseDragVec); // エッジを作り直す。// Knot.UpdateBeadsを呼び出す。 if (thisKnot == null) { thisKnot = ThisKnot.GetComponent <Knot>(); } thisKnot.Modify(); //Debug.Log("before UpdateBeadsAtNode " + thisKnot.GetNodeByID(0).ThisBead.Position); thisKnot.UpdateBeadsAtNode(DraggedNode); //Debug.Log("after UpdateBeadsAtNode " + thisKnot.GetNodeByID(0).ThisBead.Position); //// ドラッグしているノードについて、回転して適正な位置にする。 if (Input.GetKey(KeyCode.Q)) { DraggedNode.Theta += 0.01f; } else if (Input.GetKey(KeyCode.W)) { DraggedNode.Theta -= 0.01f; } //thisKnot.UpdateNodeTheta(DraggedNode); //// thisKnot.UpdateNodeRotation(); }