Fix ghost collisions in segment_intersects_convex()#106084
Merged
Repiteo merged 1 commit intogodotengine:masterfrom Oct 3, 2025
Merged
Fix ghost collisions in segment_intersects_convex()#106084Repiteo merged 1 commit intogodotengine:masterfrom
segment_intersects_convex()#106084Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
8e2744f to
ab313cd
Compare
ab313cd to
a2b9fc0
Compare
Calinou
approved these changes
Aug 26, 2025
rburing
approved these changes
Aug 26, 2025
Member
rburing
left a comment
There was a problem hiding this comment.
I didn't check the rest of the function but the added code is correct and should be there indeed.
Contributor
|
Thanks! |
segment_intersects_convex()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously
segment_intersects_convex()ignored planes parallel to the segment. This is because the segment cannot intersect this plane. However, if the points are above the plane then that means the plane separates the hull from the segment and therefore the segment cannot possibly intersect the convex hull.I encountered this bug doing procedural level generation with a concave shape similar to a heightmap with true holes and found it much faster to skip the physics server and just do manual collision checking, but this bug caused many incorrect collisions and poor results. After the fix the collision works flawlessly.
master:

This pr:

As you can see the function works in most cases in master, however the two segment marked as "bad" are parallel to the plane of the box which is facing them. Currently this means that the top plane of the box is counted as intersecting (which is wrong).
The project from the screenshots is available here: mrp.zip
Notice how in master if you change the x coordinates for segments 0 or 1, they stop reporting false collisions.
Fixes #69455.