public static void DrawProperty(ref OBB2D shape) { shape.size = EditorGUILayoutExt.Vector2Field("Size", shape.size); var deg = EditorGUILayoutExt.FloatField("Deg", shape.deg); if (deg != shape.deg) { shape.SetDeg(deg); } }
public static void DrawOBB(OBB2D obb, Color color) { var right = obb.size.x * obb.right; var up = obb.size.y * obb.up; var lb = obb.pos - up - right; var lt = obb.pos + up - right; var rt = obb.pos + up + right; var rb = obb.pos - up + right; Debug.DrawLine(lb.ToVector2(), lt.ToVector2(), color); Debug.DrawLine(lt.ToVector2(), rt.ToVector2(), color); Debug.DrawLine(rt.ToVector2(), rb.ToVector2(), color); Debug.DrawLine(rb.ToVector2(), lb.ToVector2(), color); }
void ShowShape(ref OBB2D obb, int idx) { ShowShape(ref obb, idx, DrawProperty); }