private void ShowPoint(int index) { if (mesh.moveVertexPoint) { Vector3 point = handleTransform.TransformPoint(mesh.vertices[index]); Handles.color = Color.blue; point = Handles.FreeMoveHandle(point, handleRotation, mesh.handleSize, Vector3.zero, Handles.DotHandleCap); if (GUI.changed) { mesh.DoAction(index, handleTransform.InverseTransformPoint(point)); } } else { //click } }
private void ShowPoint(int index) { if (mesh.moveVertexPoint) { //draw dot Vector3 point = handleTransform.TransformPoint(mesh.vertices[index]); Handles.color = Color.blue; point = Handles.FreeMoveHandle(point, handleRotation, mesh.handleSize, Vector3.zero, Handles.DotHandleCap); //drag if (GUI.changed) { // inverse because it's worldspace and we need localspace mesh.DoAction(index, handleTransform.InverseTransformPoint(point)); } } else { //click } }
private void ShowPoint(int index) { if (mesh.moveVertexPoint) { Vector3 point = handleTransform.TransformPoint(mesh.vertices[index]); //1 Handles.color = Color.red; point = Handles.FreeMoveHandle(point, handleRotation, mesh.handleSize, Vector3.zero, Handles.DotHandleCap); //2 Debug.Log("point:" + point + " " + index); if (GUI.changed) //3 { Debug.Log("UI.changed:" + point + " " + index); mesh.DoAction(index, handleTransform.InverseTransformPoint(point)); //4 } } else { //click } }
private void ShowPoint(int index) { if (mesh.moveVertexPoint) { //draw dot //Converts the vertex local position into world space Vector3 point = handleTransform.TransformPoint(mesh.vertices[index]); //Set color, size and position of the dot and makes an unconstrained movement handle to facilitate the dragging action Handles.color = Color.blue; point = Handles.FreeMoveHandle(point, handleRotation, mesh.handleSize, Vector3.zero, Handles.DotHandleCap); //drag if (GUI.changed) //Monitors any changes made to the dots { mesh.DoAction(index, handleTransform.InverseTransformPoint(point)); //Receive its index and Transform values as params } } else { //click } }