Add missing collision approximation option for python omni.physx.scripts.utils.setCollider

Hello,

I’m using issac sim 2022.2.0-rc.15 with kit SDK 104.1 and client library 2.21.2
In the Isaac sim GUI physics collider approximation has these options: Triangle Mesh, Convex Decomposition, Convex Hull, Bounding Sphere, Bounding Cube, Mesh Simplification and SDF Mesh.

While when using the python function omni.physx.scripts.utils.setCollider, the mapping for possible meshApproximations is defined as:

    meshApproximations = {
        "none": PhysxSchema.PhysxTriangleMeshCollisionAPI,
        "convexHull": PhysxSchema.PhysxConvexHullCollisionAPI,
        "convexDecomposition": PhysxSchema.PhysxConvexDecompositionCollisionAPI,
        "meshSimplification": PhysxSchema.PhysxTriangleMeshSimplificationCollisionAPI,
        "convexMeshSimplification": PhysxSchema.PhysxTriangleMeshSimplificationCollisionAPI,
        "boundingCube": None,
        "boundingSphere": None,
    }

The option I’m interested in, SDF Mesh, is missing. A small one line addition to the dictionary seems to work:

    meshApproximations = {
        "none": PhysxSchema.PhysxTriangleMeshCollisionAPI,
        "convexHull": PhysxSchema.PhysxConvexHullCollisionAPI,
        "convexDecomposition": PhysxSchema.PhysxConvexDecompositionCollisionAPI,
        "meshSimplification": PhysxSchema.PhysxTriangleMeshSimplificationCollisionAPI,
        "convexMeshSimplification": PhysxSchema.PhysxTriangleMeshSimplificationCollisionAPI,
        "boundingCube": None,
        "boundingSphere": None,
        "sdfMesh": PhysxSchema.PhysxSDFMeshCollisionAPI,
    }

I would have created a PR, but couldn’t find the extension source on github/anywhere. (that means also couldn’t check if it’s actually fixed on master or something). Hopefully someone from Nvidia can pick up the change.

That looks like an oversight when we added the new approximation type, will fill in a Jira ticket internally and fix it for next release. Thanks for reporting!

1 Like

Thanks for the catch @kristjan.laht! I’ve submitted a fix a few days ago which will eventually get to a public build :) I used “sdf” as the identification string, since it was actually already implemented as such in other places and I missed this method (so a part of the fix was creating a centralized dictionary of the identifiers which is now used from different extensions so this oversight should not happen again should we add more approximations in the future…). Thanks again for reporting this!

1 Like

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