Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for the sprite display position jumps when placed at subpixel locations and moving the camera #41534

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion servers/rendering/rendering_server_canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ void RenderingServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transfo
ci->children_order_dirty = false;
}

Transform2D p_transform2 = p_transform;
p_transform2.elements[2] = p_transform2.elements[2].floor(); // Clean the undesirable fractional part distorting the final display position
Transform2D xform = p_transform2 * ci->xform;

Rect2 rect = ci->get_rect();
Transform2D xform = p_transform * ci->xform;
Rect2 global_rect = xform.xform(rect);
global_rect.position += p_clip_rect.position;

Expand Down