Increase size of WorldBoundaryShape to be much larger #90763
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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 usingFLT_MAX * 0.5
in the rect/AABB calculation is particularly safe in terms of precision. ↩