From 3f5db82a89460e1f80015b625b039aba875fd13f Mon Sep 17 00:00:00 2001 From: LikeLakers2 <1008889+LikeLakers2@users.noreply.github.com> Date: Fri, 5 Jul 2019 21:22:09 -0400 Subject: [PATCH] Camera2D's offset now ignores the limit property --- scene/2d/camera_2d.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index a0d74dd2834..6011941142a 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -140,9 +140,6 @@ Transform2D Camera2D::get_camera_transform() { Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5 * zoom) : Point2()); Rect2 screen_rect(-screen_offset + camera_pos, screen_size * zoom); - if (offset != Vector2()) - screen_rect.position += offset; - if (limit_smoothing_enabled) { if (screen_rect.position.x < limit[MARGIN_LEFT]) camera_pos.x -= screen_rect.position.x - limit[MARGIN_LEFT]; @@ -193,21 +190,8 @@ Transform2D Camera2D::get_camera_transform() { if (screen_rect.position.y < limit[MARGIN_TOP]) screen_rect.position.y = limit[MARGIN_TOP]; - if (offset != Vector2()) { - + if (offset != Vector2()) screen_rect.position += offset; - if (screen_rect.position.x + screen_rect.size.x > limit[MARGIN_RIGHT]) - screen_rect.position.x = limit[MARGIN_RIGHT] - screen_rect.size.x; - - if (screen_rect.position.y + screen_rect.size.y > limit[MARGIN_BOTTOM]) - screen_rect.position.y = limit[MARGIN_BOTTOM] - screen_rect.size.y; - - if (screen_rect.position.x < limit[MARGIN_LEFT]) - screen_rect.position.x = limit[MARGIN_LEFT]; - - if (screen_rect.position.y < limit[MARGIN_TOP]) - screen_rect.position.y = limit[MARGIN_TOP]; - } camera_screen_center = screen_rect.position + screen_rect.size * 0.5;