How do you use a script to change an object's gravity properties?

I wanna simulate an object falling from a shelf, but dont want to have it happen right when the simulation starts. Im hoping to have the object’s gravity start off by being off and then turning it on by using a simple script, however I can’t figure out what the right property or how to reference it correctly is to make this happen. Any help would be appreciated.

You can start the simulation with that rigid body sleeping:

Then you can wakeUp that rigid body when you need it:

from omni.physx import get_physx_simulation_interface
from pxr import PhysicsSchemaTools

stage_id = UsdUtils.StageCache.Get().GetId(stage).ToLongInt()
rbo_encoded = PhysicsSchemaTools.sdfPathToInt(cubePrim.GetPrimPath())

get_physx_simulation_interface().wake_up(stage_id, rbo_encoded)


1 Like

I am having trouble to get this to work and am getting a ‘NameError: name UsdUtils is not defined’. Is this something I need to import? Additionally, would it be correct that stage would be a variable from something like:

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

and similarly the cubePrim that you pass into sdfPathToInt():

cube = stage.GetPrimAtPath("/World/Cube_01")

Thanks for your help sorry I am quite new to this. I am hoping to just manually set the item to start asleep using its properties in Isaac sim itself and then create just a simple script/standalone example that would wake the object up when a certain button was pressed.

the pxr usd api may be relevant - UsdUtils module — pxr-usd-api 105.1 documentation (

Yes, you need to import it from pxr, from pxr import UsdUtils.

The stage is the one you get from the context correct, the path can be used directly as the string yes.