Hi
I’m writing an extension for IsaacSim.
How can I add physics to a mesh (like with right click > Physics > Rigid Body with Colliders Preset) from my py code?
this should help:
1 Like
Thank you, Simplychenable
I solved my problem like this:
from pxr import UsdPhysics
stage = omni.usd.get_context().get_stage()
pp_box = '/Box'
cubeGeom = UsdGeom.Cube.Define(stage, pp_box)
cubeGeom.CreateSizeAttr(0.4)
cubeGeom.AddTranslateOp().Set(Gf.Vec3f(28.4, 59.52, 2.05))
cubeGeom.AddScaleOp().Set(Gf.Vec3f(1))
prim = stage.GetPrimAtPath(pp_box)
UsdPhysics.RigidBodyAPI.Apply(prim)
UsdPhysics.CollisionAPI.Apply(prim)
UsdPhysics.MassAPI.Apply(prim)
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.