-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 indices winding in convex hull generator #50256
Fix indices winding in convex hull generator #50256
Conversation
CC @mortarroad in case you would like to review. |
That will work as long as the faces are all single triangles. I'm not sure if it will work if it is a fan, but I don't know whether the bullet convex hull generator generates any fans. I'll see if I can try this out. Also the inserts at the front each time is not the most efficient, but I don't know if you can read from bullet how many indices there are in the face in advance. Mind you if it is always 3 you could resize the output face indices to 3 in advance and write in reverse order. EDIT: Yes it does produce fans. Let me see if this will work as is or need tweaking. Ok with a flat face the result looks the same, but the topology will change I think. So instead what I think you need to do is this:
Something like:
If you simply reverse the order, the base vertex of the fan will change and hence the topology. BTW don't worry excessively about the presizing the output in advance, it's just a nitpick. It won't be the bottleneck. |
Invert indices to match Godot's winding like the previous QuickHull algorithm was doing.
349167f
to
e238ed6
Compare
@lawnjelly I just found out there was a method From what I've tested, it does exactly the change you suggested compared to my previous version, so it should be all good now. |
Great that sounds even better. 👍 |
Hm? Is this really broken? I didn't actually verify the winding, but I remember testing which one works with the Godot physics. It caused objects to fall through the ground, so I already flipped it back then. |
Hm, I suppose it is wrong. getNextEdgeOfFace() says that it returns counter-clockwise, and apparently Godot does things clockwise... I will provide a patch soon. |
Try this:
Verified working (with the 0, 1, 2 order change for the plane as in the PR originally):
Actually I copied the whole |
Superseded by #50282. |
Invert indices to match Godot's winding like the previous QuickHull algorithm was doing.
Follow-up to #48533 (comment) (CC @lawnjelly)