Collision physics issue - objects passing through each other and not fitting correctly

Hi, I’m trying to get a Kitkat bar to fall into a slot in a container, but the collision physics are not behaving as expected.

Physics scene settings for the container and the Kitkat:

Kitkat:

Container:

I’ve also tried changing the settings as follows, to no avail:

  • enableGPUDynamics = Disabled
  • collisionSystem = PCM
  • solverType = TGS
  • broadphaseType = MBP

Issue #1: Objects are passing through each other (including the ground plane)

Collision error

Issue #2: Mesh doesn’t compute as desired in pockets - they go across the pockets rather than along the faces.

As a result, the Kitkat is not able to drop the full depth into the pocket and just floats somewhere in the middle.

I’ve tried changing the collision approximation to None and the mesh looks better, but I have to remove the PhysicsAPI prim component so I’m basically trading away physics properties to enable decent collision behaviour. Also, there is still the issue of the Kitkat passing through the wall of the container. Is there a more correct method of assigning suitable collision meshes for this application?

Here is the USD file I’ve been working with: Lunchmate_Test.usd (245.3 KB)

I couldn’t find anything in the docs about what all the different collision API settings do; are there plans to include more detail in the docs?

Regards,
Ian

What you are looking for is control over the ‘convex decomposition’ of the object. Could you tell us more about how you imported this shape and set up the physics? Is it from ShapeNet?

The second last image is actually shown with ‘convex decomposition’. I tried altering the settings under the “Details” tab, but they didn’t seem to change anything.

I created the shapes in OnShape and exported as STEP files, then imported the STEP files in Omniverse.

For physics, I added the following:

  1. physicsAPI and massAPI:mass components to the box and Kitkat XForms
  2. collisionAPI to the box and Kitkat mesh objects

Hi! The attached asset didn’t contain the child assets for the tray and the kitkat.

A few notes:

  1. As you may have noticed, Physx indeed doesn’t support rigid bodies with full mesh collision as of now . It needs to be simplified using either a convex hull or convex decomposition. We are working on a solution for that in the future.
    1.1. You can create your own convex decomposition by creating multiple proxy meshes as children of the rigid body, and assign collision to them. The final collision body will be the compound of all collision bodies. See the SmallKLT asset from the Bin Stacking demo for reference.
  2. To improve collision performance, you can enable CCD (Continuous Collision Detection) for both rigid bodies, so it sweeps the volume as it moves to check for collisions.
  3. to avoid penetration issues, you can tweak the contact offset parameter, so it adds a boundary around the collision mesh.
1 Like

Hello,

Sorry, here are the child assets (but I think your response already answered my question):
lunchmate box.usd (109.0 KB)
kitkat.usd (66.1 KB)

Thanks for the tips - I’ll try them out soon!

Hi,

I took a look at the SmallKLT box from the Bin Stacking demo and it seems like a decent workaround for now.

Thank you!