From 0ce2f76d5a7cbc72d28df053252fb094f96594bf Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Tue, 21 Jun 2016 22:35:04 +0300 Subject: [PATCH] Fix a inherited transform bug with Camera2D preview drawing Closes #5339 (cherry picked from commit f3342eb72e8d2768d2457abbec28ccedc865876a) --- scene/2d/camera_2d.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index fd8a0ed0f33..85256be9409 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -281,11 +281,10 @@ void Camera2D::_notification(int p_what) { inv_camera_transform.xform(Vector2(0, screen_size.height)) }; - Matrix32 inv_transform = get_transform().affine_inverse(); // undo global space - draw_set_transform(inv_transform.get_origin(), inv_transform.get_rotation(), inv_transform.get_scale()); + Matrix32 inv_transform = get_global_transform().affine_inverse(); // undo global space for(int i=0;i<4;i++) { - draw_line(screen_endpoints[i], screen_endpoints[(i+1)%4], area_axis_color, area_axis_width); + draw_line(inv_transform.xform(screen_endpoints[i]), inv_transform.xform(screen_endpoints[(i+1)%4]), area_axis_color, area_axis_width); } } break;