Skip to content

Commit

Permalink
Fix bad position in Camera2D offset and camera rotation if smothing e…
Browse files Browse the repository at this point in the history
…nabled.

Fix godotengine#16323 in master. Apply same solution of godotengine#2074 in rotation and offset.
  • Loading branch information
Ranoller authored Jun 15, 2020
1 parent 77990b8 commit bccc2cd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scene/2d/camera_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ void Camera2D::_notification(int p_what) {

void Camera2D::set_offset(const Vector2 &p_offset) {
offset = p_offset;
Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll();
smoothed_camera_pos = old_smoothed_camera_pos;
}

Vector2 Camera2D::get_offset() const {
Expand All @@ -361,7 +363,9 @@ Camera2D::AnchorMode Camera2D::get_anchor_mode() const {

void Camera2D::set_rotating(bool p_rotating) {
rotating = p_rotating;
Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll();
smoothed_camera_pos = old_smoothed_camera_pos;
}

bool Camera2D::is_rotating() const {
Expand Down Expand Up @@ -522,7 +526,9 @@ bool Camera2D::is_v_drag_enabled() const {
void Camera2D::set_v_offset(float p_offset) {
v_ofs = p_offset;
v_offset_changed = true;
Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll();
smoothed_camera_pos = old_smoothed_camera_pos;
}

float Camera2D::get_v_offset() const {
Expand All @@ -532,7 +538,9 @@ float Camera2D::get_v_offset() const {
void Camera2D::set_h_offset(float p_offset) {
h_ofs = p_offset;
h_offset_changed = true;
Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll();
smoothed_camera_pos = old_smoothed_camera_pos;
}

float Camera2D::get_h_offset() const {
Expand Down

0 comments on commit bccc2cd

Please sign in to comment.