The Physics properties of assets are all well-defined using Physics Schemas and Physx Schemas . The documentation of Physics properties and how to access them in code is defined in C++, but you can follow these guidelines to find the equivalent calls in python. The general usage will look like this (using generic names to represent an arbitrary API):
from pxr import Usd, UsdGeom, UsdPhysics, PhysxSchema
stage = omni.usd.get_context().get_stage()
prim = stage.GetPrimAtPath("/Path/To/Prim")
physics_api_prim = UsdPhysics.SomePhysicsAPI(prim)
physx_api_prim = PhysxSchema.AnotherPhysxAPI(prim)
# Check if the API is Applied, if not, Apply it.
if not physics_api_prim:
physics_api_prim = UsdPhysics.SomePhysicsAPI.Apply(prim)
physics_attr = physics_api_prim.GetSomePhysicsAttr()
physx_attr = physx_api_prim.GetPhysxAttr()
# Check if Attribute is authored, otherwise create it
if not physics_attr:
physics_attr = physics_api_prim.CreateSomePhysicsAttr(1.0)
In some cases, you may need to have additional parameters when casting the Prim to a given API, for example Joint Drive and Joint State do require the joint type (“Prismatic”, or “Angular”, for instance). In these cases the C++ signature will contain a “TfToken” type. Replace it with a basic string and it should work in Python.
If you need to know the attribute name of some physics attribute you see on the UI, Hover over the attribute in the properties panel, and it will show its name in the tooltip. The attribute name standard is
schema_name:attribute_name, so for example something like
physics:velocity on a rigid body means it’s using the Physics Rigid Body API and the attribute name is
velocity, so the corresponding attribute getter would be
You can run many of the UI commands through
omni.kit.commands.execute("CommandName", args). To find a list of available commands, and what args to use, open Window > Commands, then click on
Search Commands. On the window that appears, you will find an extensive list of all the commands available, and their respective documentation. Each command comes from a source Extension, and enabling/disabling extensions will change the list of available commands.