-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Physics simulation stops when generated convex hulls collide #76
Comments
Happy to help with looking into this too - just need to find some time 🙂 |
The THREE.ConvexHull is not used by the simulation at runtime — only to construct a CANNON.ConvexPolyhedron. I would guess that because collisions with other types of shapes still work, and the debug outlines look reasonable, the hulls themselves are valid. The way this hangs the browser, it looks a bit like an infinite loop in collision code? |
Thanks @donmccurdy. It looks like this might be a duplicate of this issue: #59 There's an interesting related I'll find some time to have a read and try a few things, will get back here with what I find. |
Potentially relevant: schteppe/cannon.js#459 (comment)
|
The simplifyGeometry() method is intended to ensure vertices are merged and convex triangles are connected... Lines 114 to 122 in 2927293
...but we invoke it only if we're merging multiple geometries — Lines 17 to 29 in 2927293
This might be the cause? Unfortunately it's not as simple as just adding a call to There's a lot in this library that could use serious refactoring and better unit tests, sorry for that. 😮💨 If you'd be interested in push access and just making more changes as you see fit, I'm happy to go that direction. |
Thanks @donmccurdy for the info! I think it's sent me down a good path 🙂 It looks like the issue may be in how As part of convex-convex collision, a list of connected faces is built for a given hull face. The connected faces list is is populated by searching for faces ( In |
No apologies are necessary! Thanks for creating and supporting this lib! I'm pretty keen to get to the bottom of generating convex hulls that support convex-convex collision! Happy to keep on with this and (hopefully) create a PR once I've got something working. From there, I'd also be happy to help with general improvements/upkeep, for sure 🙂 |
Sorry, haven't had much time to progress this. I did however notice there's a new PR in the cannon-es repo for simplifying the creation of convex hulls: pmndrs/cannon-es#155 I did a quick test, simply pulled the QuickHull class from that PR into three-to-cannon, and convex-convex collision works with the faces it returns. I'm going to watch that PR for now and see if something can be merged into cannon-es itself. If not, pulling that implementation into this lib could be good too! |
That sounds promising, thanks! |
Looks like that PR was closed. I'll keep watching the related issue, but in the meantime I'll find some time to create a PR using the same approach to fix this issue! |
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the generated faces in ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the generated faces in ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the generated faces in ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the generated faces in ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the generated faces in ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the connected faces generated by ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the connected faces generated by ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the connected faces generated by ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the connected faces generated by ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the connected faces generated by ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the connected faces generated by ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the connected faces generated by ConvexHull addresses this - Fixes donmccurdy#76
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the connected faces generated by ConvexHull addresses this - Fixes #76
It looks like there may be some issues with generated convex hulls. When two bodies with generated convex hull shapes collide, the physics simulation stops and the page becomes unresponsive.
I made a simple codesandbox demonstrating the issue: https://codesandbox.io/s/repro-three-to-cannon-hull-collision-issue-68jtcd?file=/src/index.ts
I haven't checked what versions have the issue, but it appears to at least be present in 4.0.2, predating the introduction of the
getShapeParameters
function. The issue may be somewhere in ConvexHull.js?The text was updated successfully, but these errors were encountered: