Load meshes into Sim?

I can’t figure out out to load .obj files into sim. A previous question has references to converting the asset to usd. However, I can’t find out how to even load a usd through the api, much less do anything like adding collision or physics properties to it.

Neither the standalone example, nor the referenced script editor conversion script seem to show how to load either a .usd or .obj file into simulation – even though you can drag and drop one into sim through the GUI and right click to add physics properties.

The Shapenet situation seems similar – with a lot of information about how to use the GUI and the only thing referenced in the documentation is asset conversion. This would also be really useful if I could get those in and make them collision or physics objects.

How can I load a .obj file? Or, if that isn’t possible through the api, how can I load a converted .usd asset, and add physics or collision to it? Additionally, where is this referenced in the API documentation?

2 Likes

I referred the steps mentioned in this thread.

  • First you have to convert OBJ files into USD files using the example script
  • Then you can use the omni.isaac.core.utils.stage.add_reference_to_stage function
  • For adding physics to the mesh refer the Frequently Used Python Snippets section in the Isaac Sim API docs

So that would look like:

import omni
from omni.physx.scripts import utils
from omni.isaac.core.utils.stage import add_reference_to_stage()

# Create a mesh in the stage
add_reference_to_stage(usd_path="omniverse://path/to/mesh.usd", prim_path="/World/mesh")
# Get the prim
mesh_prim = stage.GetPrimAtPath("/World/mesh")
# Enable physics on prim
utils.setRigidBody(mesh_prim, "convexDecomposition", False)

Also where is the documentation for omni.physx.scripts?