How to create a physicsscene properly?

I was trouble in set my physicsscene.
When I use Isaac Sim GUI to create a physicscene, like below


And then I run the code:
import omni.usd

import omni.physx.scripts.physicsUtils as physicsUtils

from pxr import Usd, UsdPhysics, Gf, UsdGeom

from isaacsim.core.api import SimulationContext

stage = omni.usd.get_context().get_stage()

cad_prim_path = "/World/Move/Stage/Mesh_016"

physics_scene_prim_path = "/World/PhysicsScene"

simulation_context = SimulationContext(physics_prim_path=physics_scene_prim_path)

simulation_context.initialize_physics()

print(simulation_context.get_physics_context())

The result is None, I think that’s why I have a AttributeError: ‘NoneType’ object has no attribute '_physx_interface before. I don’t know what can’t my physicscene can’t be detect.
And then I use the Hello World tutorial and press the LOAD buttom


Then I run the code:

import omni.usd

import omni.physx.scripts.physicsUtils as physicsUtils

from pxr import Usd, UsdPhysics, Gf, UsdGeom

from isaacsim.core.api import SimulationContext

stage = omni.usd.get_context().get_stage()

cad_prim_path = "/World/Move/Stage/Mesh_016"

physics_scene_prim_path = "/World/PhysicsScene"

simulation_context = SimulationContext(physics_prim_path=physics_scene_prim_path)

simulation_context.initialize_physics()

print(simulation_context.get_physics_context())

I got the result: <isaacsim.core.api.physics_context.physics_context.PhysicsContext object at 0x00000143F4C1E8F0>

I still don’t know what’s the different. Could someone help me?
Thanks!

Hi @chesterhsu0923 thanks for your question. See my response in About isaacsim.core.api.simulation_context and isaacsim.core.api.world problem - #3 by shalinj.

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