summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorSofox <sofoxx@gmail.com>2017-10-15 23:32:43 +0100
committerSofox <sofoxx@gmail.com>2017-10-18 11:17:42 +0100
commitaaf6e77198007bfa0b6228315a08eac92aff0d35 (patch)
treefcae1de9960e4cdc7bcdb72eb70877a3263afd17 /scene
parent0d0cb01f3385d512de0f91b0d73706a3380ec063 (diff)
Tweaks ParallaxBackground to work better with zoom. Ensures a Parallax Layer with a (1,1) motion scale synchs perfectly with a regular stationary sprite that is outside the ParallaxBackground, regardless of the zoom level and movement of the camera.
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/parallax_background.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/2d/parallax_background.cpp b/scene/2d/parallax_background.cpp
index 0ddcb7b51b..a13ce6278e 100644
--- a/scene/2d/parallax_background.cpp
+++ b/scene/2d/parallax_background.cpp
@@ -49,8 +49,8 @@ void ParallaxBackground::_notification(int p_what) {
void ParallaxBackground::_camera_moved(const Transform2D &p_transform) {
- set_scroll_offset(p_transform.get_origin());
set_scroll_scale(p_transform.get_scale().dot(Vector2(0.5, 0.5)));
+ set_scroll_offset(p_transform.get_origin() / p_transform.get_scale());
}
void ParallaxBackground::set_scroll_scale(float p_scale) {