Skip to content
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

rapier3d convex hull regression from 0.15 to 0.16 #417

Closed
LPGhatguy opened this issue Nov 10, 2022 · 8 comments · Fixed by dimforge/parry#127
Closed

rapier3d convex hull regression from 0.15 to 0.16 #417

LPGhatguy opened this issue Nov 10, 2022 · 8 comments · Fixed by dimforge/parry#127

Comments

@LPGhatguy
Copy link

Hello! We recently upgraded from rapier3d 0.15 to 0.16. We use rapier's built-in convex hull generation on some of our meshes to get a decent default collision mesh.

We have a few test scenes with dynamic bodies. One of them is a series of barrels sitting on tables that the player can shoot at. The barrel colliders are using convex hull colliders, generated by feeding all of the model's vertices into ColliderBuilder::convex_hull.

In rapier3d 0.15.0, those barrels sit on the table and are stable:

rapier3d-0.15.0.mp4

When upgrading to rapier3d 0.16.0, the barrels roll off of the table when the simulation starts:

rapier3d-0.16.0.mp4

The model is one of Kenney's free assets. Here is a zip file containing the glTF 2.0 file we load: barrel.zip.

The collisions generated from this model weren't perfect in 0.15.0, but they have regressed in 0.16.0. I understand that the data that I'm giving rapier may not be great. Using convex decomposition instead results in much better collisions but takes a long time. Is there anything else I can submit to help diagnose this issue?

@sebcrozet
Copy link
Member

Hi! Could you by any chance integrate Rapier’s debug-renderer, so I can understand exactly the geometry of the scene?

@LPGhatguy
Copy link
Author

Hey! Yeah, I think I could probably do that. How do I do that? I've been putting off building our own physics visualization, but if there's something built-in, that sounds great!

@sebcrozet
Copy link
Member

First, you need to implement the DebugRenderBackend trait. All that is required is to be able to render a colored line. Then you can create a DebugRenderPipeline and call its render method at each frame.

@LPGhatguy
Copy link
Author

Wow, that debug renderer interface is amazing, I wish I had integrated it sooner!

Here is rapier3d 0.15.0: https://i.eryn.io/2246/rapier3d-0.15.0-debug.mp4

Here is rapier3d 0.16.1: https://i.eryn.io/2246/rapier3d-0.16.1-debug.mp4

@rfurlan
Copy link

rfurlan commented Nov 16, 2022

I believe I have another example of this issue. A mesh associated with a convex hull collision proxy is dropped a few units above a plane and comes to rest atop of it on 0.15.0:

image

However on 0.16 and up, it behaves differently after initial contact with the plane.

1 frame after contact:
image

5 frames after contact:
image

10 frames after contact:
image

15 frames after contact:
image

On frame 16, the remaining visible portion of mesh associated with the rigid body instantly tunnels through the plane:
image

@rfurlan
Copy link

rfurlan commented Nov 19, 2022

The convex hull itself was generated correctly:

image

@sebcrozet
Copy link
Member

@LPGhatguy, @rfurlan Thank you both for the additional details. Could you please add the following to your Cargo.toml and see if that fixes the regression you are observing ?

[patch.crates-io]
parry3d = { git = "https://github.com/dimforge/parry", branch = "odd-convex" }

@rfurlan
Copy link

rfurlan commented Jan 9, 2023

@sebcrozet yes everything behaves as expected with the patch, thank you :)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants