Omni PhysX Commands#

Physics commands are providing undo/redo capability for a list of utilities from omni.physx.utils and omni.physx.physicsUtils or are directly applying or removing APIs from the physics USD schemas in defined sets which we call ‘Components’ (see our API documentation).

For a general overview of the command system see Kit Commands documentation.

Utility Commands#

class omni.physxcommands.AddCollisionGroupCommand(stage, path)

Wrapper for omni.physx.utils.addCollisionGroup. Creates a UsdPhysics.CollisionGroup prim.

Parameters:
  • stage – USD stage.

  • path – Path of the primitive to be created at.

class omni.physxcommands.AddDeformableBodyMaterialCommand(
stage,
path,
dampingScale=None,
density=None,
dynamicFriction=None,
elasticityDamping=None,
poissonsRatio=None,
youngsModulus=None,
)

Wrapper for omni.physx.deformableUtils.add_deformable_body_material. Creates a UsdShade.Material prim if needed and adds a PhysxSchema.PhysxDeformableBodyMaterialAPI to it.

Parameters:
  • stage – USD stage.

  • path – Path of the primitive to be created at.

  • dampingScale – Physics material param.

  • density – Physics material param.

  • dynamicFriction – Physics material param.

  • elasticityDamping – Physics material param.

  • poissonsRatio – Physics material param.

  • youngsModulus – Physics material param.

class omni.physxcommands.AddDeformableSurfaceMaterialCommand(
stage,
path,
density=None,
dynamicFriction=None,
poissonsRatio=None,
thickness=None,
youngsModulus=None,
)

Wrapper for omni.physx.deformableUtils.add_deformable_surface_material. Creates a UsdShade.Material prim if needed and adds a PhysxSchema.PhysxDeformableSurfaceMaterialAPI to it.

Parameters:
  • stage – USD stage.

  • path – Path of the primitive to be created at.

  • density – Physics material param.

  • dynamicFriction – Physics material param.

  • poissonsRatio – Physics material param.

  • thickness – Physics material param.

  • youngsModulus – Physics material param.

class omni.physxcommands.AddGroundPlaneCommand(stage, planePath, axis, size, position, color)

Wrapper for omni.physx.physicsUtils.add_ground_plane. Adds a zero-thick plane to prevent physics-enabled prims from falling to infinity. Creates an UsdGeom.Xform with a UsdGeom.Mesh and a UsdGeom.Plane child primitives.

Parameters:
  • stage – USD stage.

  • planePath – Path for the root xform to be created at. Finds first free path.

  • axis – Up axis.

  • size – Halfsize of one side.

  • position – Center of the plane.

  • color – Display color.

Returns:

Path where the plane was actually created.

class omni.physxcommands.AddPBDMaterialCommand(
stage,
path,
friction=None,
particle_friction_scale=None,
damping=None,
viscosity=None,
vorticity_confinement=None,
surface_tension=None,
cohesion=None,
adhesion=None,
particle_adhesion_scale=None,
adhesion_offset_scale=None,
gravity_scale=None,
lift=None,
drag=None,
density=None,
cfl_coefficient=None,
)

Wrapper for omni.physx.particleUtils.add_pbd_particle_material. Adds a PhysxSchema.PhysxPBDMaterialAPI to a UsdShade.Material prim, and creates the material prim if needed.

Parameters:
  • stage – USD stage.

  • path – Path of the material to add the API to / or create a material if needed

  • params (Material)

  • doc (see schema API)

  • friction

  • particle_friction_scale

  • damping

  • viscosity

  • vorticity_confinement

  • surface_tension

  • cohesion

  • adhesion

  • particle_adhesion_scale

  • adhesion_offset_scale

  • gravity_scale

  • lift

  • drag

  • density

  • cfl_coefficient

class omni.physxcommands.AddPairFilterCommand(stage, primPaths)

Wrapper for omni.physx.utils.addPairFilter. Filters out collisions between primitives using UsdPhysics.FilteredPairsAPI.

Parameters:
  • stage – USD stage.

  • primPaths – List of paths.

class omni.physxcommands.AddPhysicsSceneCommand(stage, path)

Wrapper for omni.physx.utils.addPhysicsScene. Adds a UsdPhysics.Scene prim with default params.

Parameters:
  • stage – USD stage.

  • path – Path of the primitive to be created at.

class omni.physxcommands.AddRigidBodyMaterialCommand(
stage,
path,
density=None,
staticFriction=None,
dynamicFriction=None,
restitution=None,
)

Wrapper for omni.physx.utils.addRigidBodyMaterial. Creates a UsdShade.Material prim if needed and adds a UsdPhysics.MaterialAPI to it.

Parameters:
  • stage – USD stage.

  • path – Path of the primitive to be created at.

  • density – Physics material param.

  • staticFriction – Physics material param.

  • dynamicFriction – Physics material param.

  • restitution – Physics material param.

class omni.physxcommands.CreateJointCommand(stage, joint_type, from_prim, to_prim)

Wrapper for omni.physx.utils.createJoint. Connects two primitives with a physical joints.

Parameters:
  • stage – Path of the target primitive.

  • joint_type – Fixed, Revolute, Prismatic, Spherical or Distance. If left blank a D6 Joint is used.

  • from_prim – From primitive.

  • to_prim – To primitive.

Returns:

Joint primitive.

class omni.physxcommands.CreateJointsCommand(stage, joint_type, paths, join_to_parent=False)

Wrapper for omni.physx.utils.createJoints. Connects a list of primitives with their parent or a pseudo-root with physical joints.

Parameters:
  • stage – Path of the target primitive.

  • joint_type – Fixed, Revolute, Prismatic, Spherical or Distance. If left blank a D6 Joint is used.

  • paths – A list of paths.

  • join_to_parent – Connect primitives to their parents if True, otherwise to a scene pseudo-root.

Returns:

Joint primitives.

class omni.physxcommands.RemovePairFilterCommand(stage, primPaths)

Wrapper for omni.physx.utils.removePairFilter. Removes UsdPhysics.FilteredPairsAPI from primitives.

Parameters:
  • stage – USD stage.

  • primPaths – List of paths.

class omni.physxcommands.RemoveRigidBodyCommand(path)

Wrapper for omni.physx.utils.removeRigidBody.

Parameters:

path – Path of the target primitive.

class omni.physxcommands.RemoveStaticColliderCommand(path)

Wrapper for omni.physx.utils.removeStaticCollider.

Parameters:

path – Path of the target primitive.

class omni.physxcommands.SetRigidBodyCommand(
path,
approximationShape='convexHull',
kinematic=False,
)

Wrapper for omni.physx.utils.setRigidBody. Applies UsdPhysics.RigidBodyAPI and a UsdPhysics.CollisionAPI to target prim. Applies UsdPhysics.MeshCollisionAPI if it’s a mesh. Collision API’s are also applied to the whole subtree if the target prim is an xform.

Parameters:
  • path – Path of the target primitive.

  • approximationShape – Physics param.

  • kinematic – Physics param.

class omni.physxcommands.SetStaticColliderCommand(path, approximationShape='none')

Wrapper for omni.physx.utils.setStaticCollider. Applies Collision APIs (UsdPhysics.CollisionAPI, UsdPhysics.MeshCollisionAPI) to a target prim and its subtree.

Parameters:
  • path – Path of the target primitive.

  • approximationShape – Physics param.

Helper Commands#

class omni.physxcommands.ApplyAPISchemaCommand(
api,
prim,
api_prefix=None,
multiple_api_token=None,
)

Undoable Apply API command.

Parameters:
  • api – API class.

  • prim – Target primitive.

  • api_prefix – Prefix of a multiple-apply API.

  • multiple_api_token – Token of a multiple-apply API.

class omni.physxcommands.ChangeAttributeCommand(
attr: Attribute,
widget: Any,
value: Any,
prev: Any,
)

Change prim property undoable Command.

Parameters:
  • attr (attribute) – Attribute to change.

  • value – Value to change to.

  • value – Value to undo to.

class omni.physxcommands.PhysicsCommand

Base class for physics commands. Adds an execute helper to not force the user to use only keyword arguments

class omni.physxcommands.RemoveAttributeCommand(attribute, prim)
class omni.physxcommands.RemoveRelationshipCommand(relationship, prim)
class omni.physxcommands.UnapplyAPISchemaCommand(
api,
prim,
api_prefix=None,
multiple_api_token=None,
)

Undoable Unapply API command.

Parameters:
  • api – API class.

  • prim – Target primitive.

  • api_prefix – Prefix of a multiple-apply API.

  • multiple_api_token – Token of a multiple-apply API.

Component Commands#

class omni.physxcommands.AddPhysicsComponentCommand(
usd_prim: Prim,
component: str,
multiple_api_token: str | None = None,
)

Add physics component command. See omni.physx.commands source for currently valid component names.

Parameters:
  • usd_prim – USD prim to apply a component to.

  • str – Component name.

  • multiple_api_token – Component instance name (if applicable).

class omni.physxcommands.RemovePhysicsComponentCommand(
usd_prim: Prim,
component: str,
multiple_api_token: str | None = None,
)

Remove physics component. See omni.physx.commands source for currently valid components.

Parameters:
  • usd_prim – USD prim to apply a component to.

  • str – Component name.

  • multiple_api_token – Component instance name (if applicable).

For a list of low-level component commands called through AddPhysicsComponentCommand and RemovePhysicsComponentCommand see below:

class omni.physxcommands.AddD6PhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)
class omni.physxcommands.AddDistancePhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)
class omni.physxcommands.AddFixedPhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)
class omni.physxcommands.AddPrismaticPhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)
class omni.physxcommands.AddRevolutePhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)
class omni.physxcommands.AddSphericalPhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)
class omni.physxcommands.RemoveD6PhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)
class omni.physxcommands.RemoveDistancePhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)
class omni.physxcommands.RemoveFixedPhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)
class omni.physxcommands.RemovePrismaticPhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)
class omni.physxcommands.RemoveRevolutePhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)
class omni.physxcommands.RemoveSphericalPhysicsJointComponentCommand(
usd_prim: Prim,
component: str,
)