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

Increase size of WorldBoundaryShape to be much larger #90763

Merged

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Apr 16, 2024

The size was previously 20,000 pixels or units, which could be easily reached in many projects. It is now 2,000,000,000,000,000 pixels or units1, which is larger than the supported coordinate space with a single-precision build, and still very large in a double precision build.

I've tested this in 2D and 3D, and it works well even when far away from the world origin, even if the WorldBoundaryShape3D is being continuously moved or rotated. No precision issues occur as a result of this change (if there are precision issues, they were already present in master).

Testing project: test_worldboundaryshape3d.zip

Footnotes

  1. It might be possible to use FLT_MAX if we want to cover the full range of floating-point numbers, but I don't know if using FLT_MAX * 0.5 in the rect/AABB calculation is particularly safe in terms of precision.

The size was previously 20,000 pixels or units, which could be easily
reached in many projects. It is now 2,000,000,000,000,000 pixels or units,
which is larger than the supported coordinate space with a single-precision
build, and still very large in a double precision build.
@Calinou Calinou added this to the 4.3 milestone Apr 16, 2024
@Calinou Calinou requested a review from a team as a code owner April 16, 2024 16:29
Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature makes sense to me.

@akien-mga akien-mga merged commit 093d064 into godotengine:master Apr 17, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@Calinou Calinou deleted the worldboundaryshape-increase-size branch April 17, 2024 20:48
@Calinou Calinou added the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release topic:physics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WorldBoundaryShape2D doesn't work when moving a little farther than 11000px away
4 participants