Hello, how can I add physics (rigid body collisions preset) to a primitive (Xform) in omniverse through python scripting? I am aware of how to do it via the front-end UI, but would like a python script to do it instead. The closest I’ve seen in the docs is How can I turn off the collision of the robot while simulation is running? - #2 by AlesBorovicka. I’ve tried something below based on the OpenUSD documentation ( Universal Scene Description: UsdPhysicsRigidBodyAPI Class Reference (openusd.org)) which prints true but does not add the physics to the body.
rigidBodyAPI = UsdPhysics.RigidBodyAPI(self._prim)
rigidBodyAPI.CreateRigidBodyEnabledAttr()
rigidBodyAPI.GetRigidBodyEnabledAttr().Set(True)
print(f’{rigidBodyAPI.GetRigidBodyEnabledAttr().Get()}')