Programmatically set SDF mesh collision

I’m trying to create an object with Signed-Distance-Field (SDF) mesh collision from a python script. I can create the rigid body using utils.setRigidBody(prim, approximationShape, kinematic) from omni.physx.scripts but the only values availables are: none, convexHull, convexDecomposition, meshSimplification, convexMeshSimplification, boundingCube and boundingSphere. However, from Isaac Sim GUI I can correctly set the SDF Mesh approximation.

I guess the only way to do it is by Pixar API but I couldn’t find more info appart from here. I saw that Chair Stacking, Franka Brick Stacking and Nuts and Bolts physics demos are using SDF collision, but I couldn’t find out how the SDF collision is set. Looking at the Chair Stacking, which is the simplest example, there is no line of code setting a collision, right? What am I missing?

Thanks in advance!

Hi @dgarcialopez - Someone from our team will review and respond to your question.

1 Like

Did you try to set the colliders and approximation shape on your model in Omniverse Create and just import the props like that, without editing afterwards?

You can do that from python code using this snippet:

        meshCollision = PhysxSchema.PhysxSDFMeshCollisionAPI.Apply(self._stage.GetPrimAtPath(self._torus_path))
        meshCollision.CreateSdfResolutionAttr().Set(256)

Though it might be that in your version, this API looks different. Can you please try it, if this API exists? If not can you please tell me what version of kit you are using? In the help about?
I can then give you the python code.
Thanks, regards
Ales

@valentinhendrik Yes, this is the workaround I was using

Thanks @AlesBorovicka!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.