Merge pull request #91706 from rburing/interpolate_parallax2d
Fix Parallax2D physics interpolation
This commit is contained in:
commit
1e76e83d9f
1 changed files with 3 additions and 1 deletions
|
@ -54,16 +54,18 @@ void Camera2D::_update_scroll() {
|
||||||
if (is_current()) {
|
if (is_current()) {
|
||||||
ERR_FAIL_COND(custom_viewport && !ObjectDB::get_instance(custom_viewport_id));
|
ERR_FAIL_COND(custom_viewport && !ObjectDB::get_instance(custom_viewport_id));
|
||||||
|
|
||||||
|
Size2 screen_size = _get_camera_screen_size();
|
||||||
|
|
||||||
Transform2D xform;
|
Transform2D xform;
|
||||||
if (is_physics_interpolated_and_enabled()) {
|
if (is_physics_interpolated_and_enabled()) {
|
||||||
xform = _interpolation_data.xform_prev.interpolate_with(_interpolation_data.xform_curr, Engine::get_singleton()->get_physics_interpolation_fraction());
|
xform = _interpolation_data.xform_prev.interpolate_with(_interpolation_data.xform_curr, Engine::get_singleton()->get_physics_interpolation_fraction());
|
||||||
|
camera_screen_center = xform.affine_inverse().xform(0.5 * screen_size);
|
||||||
} else {
|
} else {
|
||||||
xform = get_camera_transform();
|
xform = get_camera_transform();
|
||||||
}
|
}
|
||||||
|
|
||||||
viewport->set_canvas_transform(xform);
|
viewport->set_canvas_transform(xform);
|
||||||
|
|
||||||
Size2 screen_size = _get_camera_screen_size();
|
|
||||||
Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5) : Point2());
|
Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5) : Point2());
|
||||||
Point2 adj_screen_pos = camera_screen_center - (screen_size * 0.5);
|
Point2 adj_screen_pos = camera_screen_center - (screen_size * 0.5);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue