-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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 debug line drawing with tiny convex hull mesh colliders #69197
Conversation
In terms of a lot of usage, if a convex hull has no planes, it is undefined. So e.g. a point or line segment is not strictly speaking a valid convex hull - there can be infinite planes for both, and they have no volume. So whether these will work in many convex hull routines I don't know (in most hull generation / sliding code I have written in the past this would be an error, but it's just possible the existing godot physics routines might deal with it gracefully). But very dodgy territory. A tetrahedron should be okay though, it has volume. |
@lawnjelly The current Godot physics is able to deal with points and lines gracefully aside from the few places in this PR that I modified. More details: If we wanted to change the minimum to 3 points, we would remove the |
1e9483c
to
a93d10a
Compare
@lawnjelly Updated the PR. #70403 fixed the worst offender, and I removed the changes I made to support convex hulls with 1 or 2 points. Now it's just a no-brainer update to the editor code to support drawing debug shapes for fewer points (only two points are needed to draw lines in the editor). |
a93d10a
to
24bf484
Compare
24bf484
to
49410cc
Compare
49410cc
to
35a2cae
Compare
Probably needs a physics guy to decide on, I'm not sure from the title of this class If it is meant to be a convex hull, my earlier comment was to caution that a convex hull is not really valid with less than 4 points (and these must form a tetrahedron with non-zero volume). This is the smallest form that can be changed from the 3 plane intersection form to point form back and forth, and lots of convex hull stuff will fail with an invalid hull. This may be the reason for the previous On the other hand, there is an argument to support less than 4 points for editing purposes, and let the client code deal with the case of it being invalid (or store a bool in the class to indicate whether or not it is in a valid state, because checking for zero volume is expensive). This is commonly done (I do this in the It might alternatively be intended to handle both convex hulls and non-convex hulls, but that would need a physics guy to confirm. So in summary:
|
@lawnjelly For the replacement of |
35a2cae
to
ca2904e
Compare
ca2904e
to
73cf38d
Compare
73cf38d
to
0a7e264
Compare
0a7e264
to
7ebd14b
Compare
7ebd14b
to
fd0171b
Compare
fd0171b
to
3ebb850
Compare
3ebb850
to
93ceaec
Compare
93ceaec
to
f888e03
Compare
f888e03
to
8e2863d
Compare
8e2863d
to
8d097f3
Compare
8d097f3
to
61c11de
Compare
61c11de
to
96ec117
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess as aaron has been so carefully keeping up this PR we should consider trying it, and in the absence of a full time physics maintainer I guess we have to decide as best we can.
As I say, I'm not sure about the logic of being able to have convex hulls with less than 4 points, but if this is already allowed, then I guess displaying it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lawnjelly Let's do the best we can!
Thanks! |
Godot's convex hulls support lines and planes, but the code to draw debug lines currently disables itself if there are fewer than 4 points. This means that the debug lines are not able to draw valid convex hulls with 2 or 3 points, even though there is no reason the code couldn't do that.