Merge pull request #39568 from Ranoller/patch-2

(3.2) Fix bad position in Camera2D offset and camera rotation if smot…
This commit is contained in:
Rémi Verschelde 2020-06-15 23:36:32 +02:00 committed by GitHub
commit af094253a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -351,7 +351,9 @@ void Camera2D::_notification(int p_what) {
void Camera2D::set_offset(const Vector2 &p_offset) { void Camera2D::set_offset(const Vector2 &p_offset) {
offset = p_offset; offset = p_offset;
Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll(); _update_scroll();
smoothed_camera_pos = old_smoothed_camera_pos;
} }
Vector2 Camera2D::get_offset() const { Vector2 Camera2D::get_offset() const {
@ -373,7 +375,9 @@ Camera2D::AnchorMode Camera2D::get_anchor_mode() const {
void Camera2D::set_rotating(bool p_rotating) { void Camera2D::set_rotating(bool p_rotating) {
rotating = p_rotating; rotating = p_rotating;
Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll(); _update_scroll();
smoothed_camera_pos = old_smoothed_camera_pos;
} }
bool Camera2D::is_rotating() const { bool Camera2D::is_rotating() const {
@ -559,7 +563,9 @@ void Camera2D::set_v_offset(float p_offset) {
v_ofs = p_offset; v_ofs = p_offset;
v_offset_changed = true; v_offset_changed = true;
Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll(); _update_scroll();
smoothed_camera_pos = old_smoothed_camera_pos;
} }
float Camera2D::get_v_offset() const { float Camera2D::get_v_offset() const {
@ -571,7 +577,9 @@ void Camera2D::set_h_offset(float p_offset) {
h_ofs = p_offset; h_ofs = p_offset;
h_offset_changed = true; h_offset_changed = true;
Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll(); _update_scroll();
smoothed_camera_pos = old_smoothed_camera_pos;
} }
float Camera2D::get_h_offset() const { float Camera2D::get_h_offset() const {