Context
I have a scene containing rigid body prims with meshes which have concave areas.
I apply the Convex Decomposition collision approximation but when visualizing the colliders I can see they are not very accurate to the mesh boundaries.
Notice the cube looks like it is floating off the surface of the tray.
I am using code similar to the following
mesh_collision_api = UsdPhysics.MeshCollisionAPI.Apply(prim)
mesh_collision_api.GetApproximationAttr().Set(UsdPhysics.Tokens.convexDecomposition)
You can see it results in these properties on the mesh prim.
Manual application of Convex Decomposition
I noticed if I toggle the approximation method through the UI, such as changing to Convex Hull and then back to Convex Decomposition, I get an extended set of prim attributes for physxConvexDecompositionCollision
One notable attribute is physxConvexDecompositionCollision:shrinkWrap
If I enable this property, the collider is very accurate and acceptable. 👍
Programmatic Application of Shrink Wrap
The issue I have is that when I try to apply the shrink wrap using code it does NOT behave the same way.
shrink_wrap_attr = prim.CreateAttribute(
"physxConvexDecompositionCollision:shrinkWrap",
Sdf.ValueTypeNames.Bool,
)
if shrink_wrap_attr is not None:
shrink_wrap_attr.Set(apply_shrink_wrap_for_decomposition)
This does apply the shrink wrap effect; however, the approximation is different, notice the smaller gap.
Also, I do NOT see the attribute in shown next to other Collider > Advanced properties
It is only in the RAW USD Properties
Question
How to programmatically apply Collision API with Convex Decomposition approximation using Shrink Wrap to match the UI?
I realize I could use omni.kit.commands.execute('ChangeProperty', ....)
commands but I would like to avoid this.
Perhaps there is a special Convex Decomposition Collision API I can apply to the prim?