Merge pull request #5349 from bojidar-bg/fix-camera2d-screen-preview

Fix a inherited transform bug with Camera2D preview drawing
This commit is contained in:
Rémi Verschelde 2016-06-21 21:41:10 +02:00 committed by GitHub
commit e69e50040b
1 changed files with 2 additions and 3 deletions

View File

@ -281,11 +281,10 @@ void Camera2D::_notification(int p_what) {
inv_camera_transform.xform(Vector2(0, screen_size.height)) inv_camera_transform.xform(Vector2(0, screen_size.height))
}; };
Matrix32 inv_transform = get_transform().affine_inverse(); // undo global space Matrix32 inv_transform = get_global_transform().affine_inverse(); // undo global space
draw_set_transform(inv_transform.get_origin(), inv_transform.get_rotation(), inv_transform.get_scale());
for(int i=0;i<4;i++) { 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; } break;