protected static InverseTransformPoint ( |
||
transform | ||
position | Vector3 | |
리턴 | Vector3 |
public void OnSceneGUI() { this.anchorJoint2D = (AnchoredJoint2D)this.target; Vector3 position = Joint2DEditorBase.TransformPoint(this.anchorJoint2D.transform, (Vector3)this.anchorJoint2D.anchor); Vector3 connectedAnchor = (Vector3)this.anchorJoint2D.connectedAnchor; if (this.anchorJoint2D.connectedBody != null) { connectedAnchor = Joint2DEditorBase.TransformPoint(this.anchorJoint2D.connectedBody.transform, connectedAnchor); } Vector3 vector4 = connectedAnchor - position; Vector3 vector3 = position + ((Vector3)((vector4.normalized * HandleUtility.GetHandleSize(position)) * 0.1f)); Handles.color = Color.green; Vector3[] points = new Vector3[] { vector3, connectedAnchor }; Handles.DrawAAPolyLine(points); if (base.HandleAnchor(ref connectedAnchor, true)) { connectedAnchor = Joint2DEditorBase.SnapToPoint(this.SnapToSprites(connectedAnchor), position, 0.13f); if (this.anchorJoint2D.connectedBody != null) { connectedAnchor = Joint2DEditorBase.InverseTransformPoint(this.anchorJoint2D.connectedBody.transform, connectedAnchor); } Undo.RecordObject(this.anchorJoint2D, "Move Connected Anchor"); this.anchorJoint2D.connectedAnchor = connectedAnchor; } if (base.HandleAnchor(ref position, false)) { position = Joint2DEditorBase.SnapToPoint(this.SnapToSprites(position), connectedAnchor, 0.13f); Undo.RecordObject(this.anchorJoint2D, "Move Anchor"); this.anchorJoint2D.anchor = Joint2DEditorBase.InverseTransformPoint(this.anchorJoint2D.transform, position); } }
public void OnSceneGUI() { this.anchorJoint2D = (AnchoredJoint2D)this.target; Vector3 vector = Joint2DEditorBase.TransformPoint(this.anchorJoint2D.transform, this.anchorJoint2D.anchor); Vector3 vector2 = this.anchorJoint2D.connectedAnchor; if (this.anchorJoint2D.connectedBody) { vector2 = Joint2DEditorBase.TransformPoint(this.anchorJoint2D.connectedBody.transform, vector2); } Vector3 vector3 = vector + (vector2 - vector).normalized * HandleUtility.GetHandleSize(vector) * 0.1f; Handles.color = Color.green; Handles.DrawAAPolyLine(new Vector3[] { vector3, vector2 }); if (base.HandleAnchor(ref vector2, true)) { vector2 = this.SnapToSprites(vector2); vector2 = Joint2DEditorBase.SnapToPoint(vector2, vector, 0.13f); if (this.anchorJoint2D.connectedBody) { vector2 = Joint2DEditorBase.InverseTransformPoint(this.anchorJoint2D.connectedBody.transform, vector2); } Undo.RecordObject(this.anchorJoint2D, "Move Connected Anchor"); this.anchorJoint2D.connectedAnchor = vector2; } if (base.HandleAnchor(ref vector, false)) { vector = this.SnapToSprites(vector); vector = Joint2DEditorBase.SnapToPoint(vector, vector2, 0.13f); Undo.RecordObject(this.anchorJoint2D, "Move Anchor"); this.anchorJoint2D.anchor = Joint2DEditorBase.InverseTransformPoint(this.anchorJoint2D.transform, vector); } }