Omni PhysX

Overview

The omni.physx extension provides a connection between USD physics content and the NVIDIA PhysX simulation engine. Physics content in USD is defined through two USD schemas: UsdPhysics which implements the standard USD physics extension schema, and PhysXSchema, which extends it with PhysX specific features.

The omni.physx plugin is responsible for parsing the USD stage, running the PhysX simulation, and writing the results back to the USD stage.

Working with Physics

Physics is activated when the play button is pressed in Omniverse Create, which leads to the following sequence of events:

  1. The USD stage is parsed and physics objects are created within PhysX. This is a blocking call, so Create will freeze for a bit. This is a known issue and will be resolved at a later stage.

  2. If required, PhysX cooking and convex decomposition is executed depending on mesh approximation USD schema attributes. The results of the cooking are cached in the USD stage file, so if the USD Stage is saved, the cooking doesn’t need to be repeated.

  3. In addition, cooked data is also cached in the workstation’s local cache, so recomputation is sometimes also avoided even when the USD stage is not saved.

  4. Simulation starts once parsing is complete.

  5. Simulation output is written to USD. By default, transformations and velocities (in local space) are written to USD. It’s possible to toggle this behavior in the Physics settings window.

  6. Omni.physx listens to USD changes, and changes are applied to PhysX while the simulation is running.

Simulation Output

Physics simulation outputs by default transformations and velocities into USD, on larger scenes this can be very slow. However it is possible to speed up the transformation updates for rendering. In Extensions window enable omni.physx.fabric extension:

  • Simulation wont write to USD, but it will use fabric to update transformation, velocities, force sensors. Note that this extensions is still under development and not all features are supported.

Note that if transformations are written only to fabric, they are not visible for the UI. It is possible to get the rigid body transformation through a IPhysX interface that does have python bindings. (see the python bindings documentation for get_rigidbody_transformation)

USD Physics Schema

The UsdPhysics schema has been developed in a collaboration between Pixar, Apple and NVIDIA. The specification can be found on the Pixar USD website as well as here in our USD schema documentation . It is recommended that the reader familiarize themselves with this important document that explains all the basic concepts in detail.

USD Physics Python Tutorials

These tutorial snippets show Physics usage through the use of the Python USD API. Note that most of the Python code here can also be found in the Physics Python demo script files.

Setting up a USD Stage and a Physics Scene

In this tutorial, a USD stage and a Physics scene are created using python APIs. By default, all bodies in the USD stage with a PhysicsScene are simulated. Without a scene, simulation will not occur. Multiple scenes per stage will be supported by Omniverse in the future.

A physics scene is represented as a PhysicsScene typed USD Prim in the Physics schema. All the required imports are also defined in this snippet and are to be re-used in the following snippets.

Note that this generates USD state as output which is then parsed as discussed above. To see the generated USD state, save the stage in text .usda format and view it in a text editor.

from pxr import Usd, UsdGeom, UsdPhysics, UsdShade, Sdf, Gf, Tf

# Set up a USD Stage to define what is the up axis and set up the units,
# which is crucial, as some default simulation parameters are derived
# from the MetersPerUnit value
stage = omni.usd.get_context().get_stage()
UsdGeom.SetStageUpAxis(stage, UsdGeom.Tokens.z)
UsdGeom.SetStageMetersPerUnit(stage, 0.01)

# Physics scene definition
scene = UsdPhysics.Scene.Define(stage, "/physicsScene")

# setup gravity
# note that gravity has to respect the selected units, if we are using cm, the gravity has to respect that
scene.CreateGravityDirectionAttr().Set(Gf.Vec3f(0.0, 0.0, -1.0))
scene.CreateGravityMagnitudeAttr().Set(981.0)

Creating Colliders

In this tutorial a static collider is created. Colliders are represented using the UsdPhysicsCollisionAPI applied schema. The schema must be applied to a geom prim. Based on the geom prim’s type, an appropriate collider is created in Physics. For mesh prims it is recommended to use UsdPhysicsMeshCollisionAPI to define mesh approximations of various types.

This code is meant to follow the stage and scene creation in the preceeding tutorial, it won’t work without that state being set up first.

# Cube path
cubeActorPath = "/cubeActor"

# Cube parameters like size, position, orientation
size = 25.0
position = Gf.Vec3f(0.0, 0.0, 500.0)
orientation = Gf.Quatf(1.0)
color = Gf.Vec3f(71.0 / 255.0, 105.0 / 255.0, 1.0)

# define the cube geom
cubeGeom = UsdGeom.Cube.Define(stage, cubeActorPath)
cubeGeom.CreateSizeAttr(size)
cubeGeom.AddTranslateOp().Set(position)
cubeGeom.AddOrientOp().Set(orientation)
cubeGeom.AddScaleOp().Set(Gf.Vec3f(1.0))
cubeGeom.CreateDisplayColorAttr().Set([color])

# get the prim
cubePrim = stage.GetPrimAtPath(cubeActorPath)

# setup collision, so that the cube does collider
UsdPhysics.CollisionAPI.Apply(cubePrim)

Different Collision and Rendering Representations

It is possible to have different collision and rendering representations. Two different geom prims have to be created, where one will serve for collision and the other for rendering. The parent xform of both prims should be the rigid body so they move together, and the collision geom prim should have the purpose “guide” set so it is not rendered.

This code is meant to follow the stage and scene creation in the first tutorial, it won’t work without that state being set up first.

# Top level actor, contains rigid body
rigidCompoundPath = "/compoundRigid"
rigidXform = UsdGeom.Xform.Define(stage, rigidCompoundPath)
rigidPrim = stage.GetPrimAtPath(rigidCompoundPath)

# Rigid body transform
rigidCompoundPos = Gf.Vec3f(0.0, 0.0, 10.0)
rigidXform.AddTranslateOp().Set(rigidCompoundPos)
rigidXform.AddOrientOp().Set(Gf.Quatf(1.0, 0.0, 0.0, 0.0))

physicsAPI = UsdPhysics.RigidBodyAPI.Apply(rigidPrim)

# Collision shape
collisionShape = rigidCompoundPath + "/physicsBoxShape"

size = 25.0
shapePos = Gf.Vec3f(0.0)
shapeQuat = Gf.Quatf(1.0)

cubeGeom = UsdGeom.Cube.Define(stage, collisionShape)
cubePrim = stage.GetPrimAtPath(collisionShape)
cubeGeom.CreateSizeAttr(size)
cubeGeom.AddTranslateOp().Set(shapePos)
cubeGeom.AddOrientOp().Set(shapeQuat)

# set it as collision
UsdPhysics.CollisionAPI.Apply(cubePrim)

# hide it from rendering
cubeGeom.CreatePurposeAttr(UsdGeom.Tokens.guide)

# rendering shape
renderSphere = rigidCompoundPath + "/renderingSphere"

sphereGeom = UsdGeom.Sphere.Define(stage, renderSphere)
#sphereGeom.CreateSizeAttr(20.0)
sphereGeom.AddTranslateOp().Set(shapePos)
sphereGeom.AddOrientOp().Set(shapeQuat)

Physics Materials

Each collider can have a different physics material assigned. UsdPhysicsMaterialAPI can be applied to any other material, and this API adds physics material propertie like static/dynamic friction. To assign a material to a collider use material binding with a purpose of “physics”.

This code is meant to follow the stage and scene creation in the first tutorial, it won’t work without that state being set up first.

Example

# define physics material
materialPath = "/material"
mu = 1.0
UsdShade.Material.Define(stage, materialPath)
material = UsdPhysics.MaterialAPI.Apply(stage.GetPrimAtPath(materialPath))
material.CreateStaticFrictionAttr().Set(mu)
material.CreateDynamicFrictionAttr().Set(mu)
material.CreateRestitutionAttr().Set(0.0)
material.CreateDensityAttr().Set(1000.0)

collisionAPI = UsdPhysics.CollisionAPI.Get(stage, collisionShape)

# add the material to the collider
bindingAPI = UsdShade.MaterialBindingAPI.Apply(collisionAPI.GetPrim())
materialPrim = material.GetPrim()
material = UsdShade.Material(materialPrim)
bindingAPI.Bind(material, UsdShade.Tokens.weakerThanDescendants, "physics")

Using Convex Mesh for Cylinder and Cone Collision

UsdGeom.Cylinder and UsdGeom.Cone prims’ collision is by default approximated as custom geometry for higher precision. However, you can set them to use convex mesh instead by disabling the corresponding toggles in the Physics settings under the collision section.

Note: you can also use the Omniverse Create built-in cone and cylinder mesh geometries for convex approximation. This allows you to fine grain control whether individual geometry should be simulated with a convex approximation or custom geometry collider.

Rigid Bodies

In this tutorial we create a cube geom primitive that will be simulated as a rigid body. A rigid body is represented in the Physics schema as UsdPhysicsRigidBodyAPI schema applied to an xformable Prim.

This code is meant to follow the stage and scene creation in the first tutorial, it won’t work without that state being set up first.

# Cube path
cubeActorPath = "/cubeActorRigid"

# Cube parameters like size, position, orientation
size = 25.0
position = Gf.Vec3f(0.0, 0.0, 500.0)
orientation = Gf.Quatf(1.0)
color = Gf.Vec3f(71.0 / 255.0, 105.0 / 255.0, 1.0)

# initial velocities
linVelocity = Gf.Vec3f(2.0, 1.0, 2.0)
angularVelocity = Gf.Vec3f(1.0, 0.0, 0.0)

# define the cube geom
cubeGeom = UsdGeom.Cube.Define(stage, cubeActorPath)
cubeGeom.CreateSizeAttr(size)
cubeGeom.AddTranslateOp().Set(position)
cubeGeom.AddOrientOp().Set(orientation)
cubeGeom.AddScaleOp().Set(Gf.Vec3f(1.0))
cubeGeom.CreateDisplayColorAttr().Set([color])

# get the prim
cubePrim = stage.GetPrimAtPath(cubeActorPath)

# setup collision, so that the cube does collider
UsdPhysics.CollisionAPI.Apply(cubePrim)

# setup physics - rigid body
rigidBodyAPI = UsdPhysics.RigidBodyAPI.Apply(cubePrim)

# apply initial velocities
rigidBodyAPI.CreateVelocityAttr().Set(linVelocity)
rigidBodyAPI.CreateAngularVelocityAttr().Set(angularVelocity)

During simulation, if you want to change linear velocity of a rigid body, you have to change the velocity attribute of UsdPhysicsRigidBodyAPI:

rigidBodyAPI.CreateVelocityAttr().Set(newVelocity)

Difference Between a Static Body and a Dynamic Body

If a Geom Prim with a UsdPhysicsCollisionAPI is found, it can belong either to a static or a dynamic body. The logic to decide goes like this:

  • If there is no UsdPhysicsRigidBodyAPI applied on the prim or on any parent Prim in the hierarchy, then the geom with the UsdPhysicsCollisionAPI is considered a static body.

  • Else:

    1. If physics:rigidBodyEnabled attribute is true (default) then the geom belongs to a dynamic body.

    2. Else the Geom belongs to a static body.

Kinematic Body

If a body needs to be driven by animation or user defined target positions, physics:kinematicEnabled attribute on UsdPhysicsRigidBodyAPI should be set to true.

CPU vs GPU Rigid Body Dynamics

By default, rigid body simulation is performed on the GPU. It is possible to override the pipeline in the Physics Debug window or using scene attributes. In order to use CPU simulation, please add a PhysxSceneAPI to the UsdPhysicsScene prim and set these attributes:

  • physxScene:broadphaseType - MBP

  • physxScene:enableGPUDynamics - False

For GPU simulation the first setting is GPU and the second is True.

Rigid Body Mass Properties

UsdPhysicsMassAPI defines the mass properties of a rigid body. UsdPhysicsMassAPI can be applied to either a prim with UsdPhysicsRigidBodyAPI or to a prim with USdPhysicsCollisionAPI. It provides various ways to define a mass properties for a rigid body:

  • physics:mass

    Note that any child Prim can also have a mass when they apply UsdPhysicsMassAPI. In this case, the precedence rule is ‘parent mass overrides the child’s’. This may come as counter-intuitive, but mass is a computed quantity and in general not accumulative. For example, if a parent has mass of 10, and one of two children has mass of 20, allowing a child’s mass to override its parents would results in -10 for mass for the other child.

  • physics:density

    In the context of rigid body physics, density indirectly results in setting mass via (mass = density x volume of the object). In the case where both density and mass are specified for the same object, mass has precedence over density. Unlike mass, a child prim’s density overrides a parent prim’s density. Note that the density of a collisionAPI can also alternatively be set through a physicsMaterial relation. The material density has the weakest precedence in density definition. Note that density respects units. So a water density is 1000 for metersPerUnit = 1 and 0.001 for metersPerUnit = 0.01.

  • physics:centerOfMass - Center of mass in prim’s local space.

  • physics:diagonalInertia - Diagonalized inertia tensor in un-rotated state.

  • physics:principalAxes - Orientation (quaternion) of the inertia tensor’s principal axes in the prim’s local space.

The parsing code does gather mass properties per collision shape and uses the computed inertia tensor to compute the final mass properties for the body. If no massAPI is found, the default density of 1000 is used to determine the final mass.

This code is meant to follow the stage and scene creation in the first tutorial, it won’t work without that state being set up first.

Example of custom center of mass .. code:

# Cube path
cubeActorPath = "/cubeActorRigidMass"

# Cube parameters like size, position, orientation
size = 25.0
position = Gf.Vec3f(0.0, 0.0, 500.0)
orientation = Gf.Quatf(1.0)
color = Gf.Vec3f(71.0 / 255.0, 105.0 / 255.0, 1.0)

# define the cube geom
cubeGeom = UsdGeom.Cube.Define(stage, cubeActorPath)
cubeGeom.CreateSizeAttr(size)
cubeGeom.AddTranslateOp().Set(position)
cubeGeom.AddOrientOp().Set(orientation)
cubeGeom.AddScaleOp().Set(Gf.Vec3f(1.0))
cubeGeom.CreateDisplayColorAttr().Set([color])

# get the prim
cubePrim = stage.GetPrimAtPath(cubeActorPath)

# setup collision, so that the cube does collider
UsdPhysics.CollisionAPI.Apply(cubePrim)

# setup physics - rigid body, so that cube does simulate as a rigid body
UsdPhysics.RigidBodyAPI.Apply(cubePrim)

# custom center of mass
massAPI = UsdPhysics.MassAPI.Apply(cubePrim)
massAPI.CreateCenterOfMassAttr().Set(Gf.Vec3f(0.0, 0.0, 10.0))

Joints

Creating a Physics joint between two bodies or between a body and the world frame.

This code is meant to follow the stage and scene creation in the first tutorial, it won’t work without that state being set up first.

# box0 static
boxActorPath = "/box0"

# box0 props
position = Gf.Vec3f(0.0, 0.0, 1000.0)
orientation = Gf.Quatf(1.0)
color = Gf.Vec3f(165.0 / 255.0, 21.0 / 255.0, 21.0 / 255.0)
size = 100.0
scale = Gf.Vec3f(0.1, 1.0, 0.1)

cubeGeom = UsdGeom.Cube.Define(stage, boxActorPath)
cubeGeom.CreateSizeAttr(size)
cubeGeom.AddTranslateOp().Set(position)
cubeGeom.AddOrientOp().Set(orientation)
cubeGeom.AddScaleOp().Set(scale)
cubeGeom.CreateDisplayColorAttr().Set([color])

# make it a static body - just apply PhysicsCollisionAPI
cubePrim = stage.GetPrimAtPath(boxActorPath)
UsdPhysics.CollisionAPI.Apply(cubePrim)

# Box1 dynamic body
boxActorPath = "/box1"

position = Gf.Vec3f(0.0, 120.0, 1000.0)
color = Gf.Vec3f(71.0 / 255.0, 165.0 / 255.0, 1.0)

cubeGeom = UsdGeom.Cube.Define(stage, boxActorPath)
cubeGeom.CreateSizeAttr(size)
cubeGeom.AddTranslateOp().Set(position)
cubeGeom.AddOrientOp().Set(orientation)
cubeGeom.AddScaleOp().Set(scale)
cubeGeom.CreateDisplayColorAttr().Set([color])

# setup dynamic rigid body
cubePrim = stage.GetPrimAtPath(boxActorPath)
UsdPhysics.CollisionAPI.Apply(cubePrim)
UsdPhysics.RigidBodyAPI.Apply(cubePrim)

# create revolute joint prim
revoluteJoint = UsdPhysics.RevoluteJoint.Define(stage, "/revoluteJoint")

# define revolute joint axis and its limits, defined in degrees
revoluteJoint.CreateAxisAttr("X")
revoluteJoint.CreateLowerLimitAttr(-90.0)
revoluteJoint.CreateUpperLimitAttr(90.0)

# define revolute joint bodies
revoluteJoint.CreateBody0Rel().SetTargets(["/box0"])
revoluteJoint.CreateBody1Rel().SetTargets(["/box1"])

# define revolute joint local poses for bodies
revoluteJoint.CreateLocalPos0Attr().Set(Gf.Vec3f(0.0, 60.0, 0.0))
revoluteJoint.CreateLocalRot0Attr().Set(Gf.Quatf(1.0))

revoluteJoint.CreateLocalPos1Attr().Set(Gf.Vec3f(0.0, -60.0, 0.0))
revoluteJoint.CreateLocalRot1Attr().Set(Gf.Quatf(1.0))

# set break force/torque
revoluteJoint.CreateBreakForceAttr().Set(1e20)
revoluteJoint.CreateBreakTorqueAttr().Set(1e20)

# optionally add angular drive for example
angularDriveAPI = UsdPhysics.DriveAPI.Apply(stage.GetPrimAtPath("/revoluteJoint"), "angular")
angularDriveAPI.CreateTypeAttr("force")
angularDriveAPI.CreateMaxForceAttr(1e20)
angularDriveAPI.CreateTargetVelocityAttr(1.0)
angularDriveAPI.CreateDampingAttr(1e10)
angularDriveAPI.CreateStiffnessAttr(0.0)

Joint Types

The currently supported joint types are:

  • Revolute joint

    A joint with one angular degree of freedom enabled. To specify a revolute joint, define a RevolutePhysicsJoint Prim. A revolute joint is defined by an axis, if limit (lower/upper) attributes are not defined the movement around the axis is not restricted. Angular drive can be set on a revolute joint, DriveAPI has to be applied to the joint Prim. Note that DriveAPI is a multiple-applied schema, in order to define the angular drive for a revolute joint, the angular token is used to define the drive.

  • Prismatic joint

    A joint with one linear degree of freedom enabled. To specify a prismatic joint, define a PrismaticPhysicsJoint Prim. A prismatic joint is defined by an axis, if the limit (lower/upper) attributes are not defined, the movement around the axis is not restricted. Linear drive can be set on a revolute joint, while DriveAPI has to be applied to the joint Prim. Note that DriveAPI is a multiple-applied schema, in order to define linear drive for a revolute joint, the angular token is used to define the drive.

  • Spherical joint

    A joint with restricted linear degree of freedom, which behaves like a ball and socket. To specify a spherical joint, define a SphericalPhysicsJoint Prim. A spherical joint is defined by an axis and a cone limit.

  • Distance joint

    A joint that allows movement in given min/max distance. To specify a distance joint, define a DistancePhysicsJoint Prim. A distance limit can separately define minDistance and maxDistance, limiting the movement between two bodies.

  • Fixed joint

    Removes all degrees of freedom. To specify a fixed joint define a FixedPhysicsJoint Prim.

  • Generic D6 joint

    If just a PhysicsJoint Prim exists, it is considered a generic D6 joint that has by default all degrees of freedom. Each degree of freedom can be limited by applying the LimitAPI. LimitAPI is a multiple-applied schema and the second token, does specify which axis should be limited. The ‘transX’, ‘transY’, ‘transZ’ tokens restrict linear degrees of freedom and ‘rotX’, ‘rotY’, ‘rotZ’ restrict angular degrees of freedom. The low/high attribute on the LimitAPI can be used to define whether the movement is limited or restricted. To restrict movement, set the low attribute to be larger than the high attribute. For each axis DriveAPI can be defined, use the same tokens as for limit to define where the DriveAPI should be applied.

Articulations

Articulations are tree structures of bodies connected by joints that are resolved as a unit by Physics.

How to Define Articulations

Articulations are defined by PhysicsJoints and their connected bodies. The parsing code is looking for UsdPhysicsArticulationRootAPI to identify articulation roots. There are two types of articulations:

  • Fixed root articulations, in this case the UsdPhysicsArticulationRootAPI should be defined on a joint to world, or a prim in its parent hierarchy.

  • Floating articulations, in this case the UsdPhysicsArticulationRootAPI should be defined on a rigidbody or a prim in its parent hierarchy.

This is an example of a simple articulation chain.

This code is meant to follow the stage and scene creation in the first tutorial, it won’t work without that state being set up first.

radius = 1.0
halfHeight = 1.0
color = Gf.Vec3f(0.4, 0.2, 0.1)
nbBoxes = 15

initPos = Gf.Vec3f(0.0, 0.0, 24.0)
pos = Gf.Vec3f(0.0, 0.0, 0.0)

# setup the articulation as a parent of the hierarchy
UsdGeom.Xform.Define(stage, "/articulation")
UsdPhysics.ArticulationRootAPI.Apply(stage.GetPrimAtPath("/articulation"))

parentName = "/articulation"

# Create chain
for i in range(nbBoxes):
    # articulation link
    linkName = "/articulation/articulationLink" + str(i)

    # capsule geom
    capsuleGeom = UsdGeom.Capsule.Define(stage, linkName)
    capsulePrim = stage.GetPrimAtPath(linkName)
    capsuleGeom.CreateHeightAttr(halfHeight)
    capsuleGeom.CreateRadiusAttr(radius)
    capsuleGeom.CreateAxisAttr("X")
    capsuleGeom.AddTranslateOp().Set(initPos + pos)
    capsuleGeom.AddOrientOp().Set(Gf.Quatf(1.0))
    capsuleGeom.AddScaleOp().Set(Gf.Vec3f(1.0, 1.0, 1.0))
    capsuleGeom.CreateDisplayColorAttr().Set([color])

    # articulation link is just a regular rigid body
    UsdPhysics.CollisionAPI.Apply(capsulePrim)
    UsdPhysics.RigidBodyAPI.Apply(capsulePrim)

    if i != 0:
        articulatedJointName = "/articulation/articulatedRevoluteJoint" + str(i)

        # joint definition between the articulation links
        component = UsdPhysics.RevoluteJoint.Define(stage, articulatedJointName)
        val0 = [Sdf.Path(parentName)]
        val1 = [Sdf.Path(linkName)]

        if parentName != "":
            component.CreateBody0Rel().SetTargets(val0)
        component.CreateLocalPos0Attr().Set(Gf.Vec3f(radius + halfHeight, 0.0, 0.0))
        component.CreateLocalRot0Attr().Set(Gf.Quatf(1.0))

        component.CreateBody1Rel().SetTargets(val1)
        component.CreateLocalPos1Attr().Set(Gf.Vec3f(-(radius + halfHeight), 0.0, 0.0))
        component.CreateLocalRot1Attr().Set(Gf.Quatf(1.0))

        component.CreateBreakForceAttr().Set(sys.float_info.max)
        component.CreateBreakTorqueAttr().Set(sys.float_info.max)

        component.CreateAxisAttr("Y")
        component.CreateLowerLimitAttr(float(-3.14 / 32.0))
        component.CreateUpperLimitAttr(float(3.14 / 32.0))

    else:
        # create the root joint
        articulatedJointName = "/articulation/rootJoint"
        component = UsdPhysics.FixedJoint.Define(stage, articulatedJointName)

        val1 = [Sdf.Path(linkName)]
        component.CreateLocalPos0Attr().Set(initPos)
        component.CreateLocalRot0Attr().Set(Gf.Quatf(1.0))

        component.CreateBody1Rel().SetTargets(val1)
        component.CreateLocalPos1Attr().Set(Gf.Vec3f(0.0, 0.0, 0.0))
        component.CreateLocalRot1Attr().Set(Gf.Quatf(1.0))

        component.CreateBreakForceAttr().Set(sys.float_info.max)
        component.CreateBreakTorqueAttr().Set(sys.float_info.max)

    parentName = linkName
    pos[0] += (radius + halfHeight) * 2.0

Collision Filtering

There are two types of collision filtering, broad filtering using PhysicsCollisionGroups and fine grained filtering using the PhysicsFilteredPairsAPI schema API.

Using PhysicsCollisionGroups

PhysicsCollisionGroup is a prim type that has a CollectionAPI:colliders applied. Prims in this collection belong to that collision group. Each PhysicsCollisionGroup has a filteredGroups rel that defines what groups this CollisionGroup should not collide against by default.

This is an example of PhysicsCollisionGroup usage.

This code is meant to follow the stage and scene creation in the first tutorial, it won’t work without that state being set up first.

from omni.physx.scripts.physicsUtils import *
from pxr import Usd, UsdGeom, Sdf, Gf, Tf, UsdPhysics

# add collision groups
cubesGroup = "/physicsScene/collisionGroupBoxes"
spheresGroup = "/physicsScene/collisionGroupSpheres"
collisionGroupCubes = UsdPhysics.CollisionGroup.Define(stage, cubesGroup)
collisionGroupSpheres = UsdPhysics.CollisionGroup.Define(stage, spheresGroup)

# setup groups so that they dont collide with each other
filteredRel = collisionGroupSpheres.CreateFilteredGroupsRel()
filteredRel.AddTarget(spheresGroup)

filteredRel = collisionGroupSpheres.CreateFilteredGroupsRel()
filteredRel.AddTarget(cubesGroup)

numActors = 20

# boxes/groupBoxes
boxActorsPath = "/boxActors"
UsdGeom.Xform.Define(stage, boxActorsPath)

size = 50.0
density = 1000.0
color = Gf.Vec3f(71.0 / 255.0, 165.0 / 255.0, 1.0)
orientation = Gf.Quatf(1.0, 0.0, 0.0, 0.0)
linVelocity = Gf.Vec3f(0.0)
angularVelocity = Gf.Vec3f(0.0)

for i in range(numActors):
    position = Gf.Vec3f(50.0, 50.0, 500.0 + i * 100.0)
    cubePath = boxActorsPath + "/boxActor" + str(i)

    add_rigid_box(
        stage,
        cubePath,
        Gf.Vec3f(size, size, size),
        position,
        orientation,
        color,
        density,
        linVelocity,
        angularVelocity,
    )

    add_collision_to_collision_group(stage, cubePath, cubesGroup)

# spheres/groupSpheres
sphereActorsPath = "/sphereActors"
UsdGeom.Xform.Define(stage, sphereActorsPath)

radius = 25.0
color = Gf.Vec3f(71.0 / 255.0, 125.0 / 255.0, 1.0)

for i in range(numActors):
    position = Gf.Vec3f(-50.0, -50.0, 500.0 + i * 100.0)
    spherePath = sphereActorsPath + "/sphereActor" + str(i)

    add_rigid_sphere(
        stage, spherePath, radius, position, orientation, color, density, linVelocity, angularVelocity
    )

    add_collision_to_collision_group(stage, spherePath, spheresGroup)

Pair Filtering

UsdPhysicsFilteredPairsAPI is used to disable collisions between individual objects like collision, body and articulation. The API is added to the object and in filteredPairs rel objects that this object should not collide against are defined.

This code is meant to follow the stage and scene creation in the first tutorial, it won’t work without that state being set up first.

from omni.physx.scripts.physicsUtils import *
from pxr import Usd, UsdGeom, Sdf, Gf, Tf, UsdPhysics

# Box0
boxActorPath = "/boxActor0"

density = 1000.0
size = Gf.Vec3f(25.0)
position = Gf.Vec3f(0.0, 0.0, 500.0)
orientation = Gf.Quatf(1.0, 0.0, 0.0, 0.0)
color = Gf.Vec3f(71.0 / 255.0, 165.0 / 255.0, 1.0)
linVelocity = Gf.Vec3f(2.0, 1.0, 2.0)
angularVelocity = Gf.Vec3f(1.0, 0.0, 0.0)

add_rigid_box(stage, boxActorPath, size, position, orientation, color, density, linVelocity, angularVelocity)

# Box1
boxActorPath = "/boxActor1"
position = Gf.Vec3f(0.0, 0.0, 250.0)
add_rigid_box(stage, boxActorPath, size, position, orientation, color, density, linVelocity, angularVelocity)

# filter collisions between Box0, Box1
boxPrim = stage.GetPrimAtPath("/boxActor0")
filteringPairsAPI = UsdPhysics.FilteredPairsAPI.Apply(boxPrim)
rel = filteringPairsAPI.CreateFilteredPairsRel()
rel.AddTarget("/boxActor1")

Contact Reports

Contact reports can be received in Python code by adding a PhysxContactReportAPI to the body or articulation Prim.

Subscribing to the contact event report, contacts are send through a callback function in two arrays.

The contact report first array contains contact headers, which can have type:

* ContactEventType.CONTACT_FOUND
* ContactEventType.CONTACT_PERSISTS
* ContactEventType.CONTACT_LOST

These events send the additional dictionary with contact information:

* actor0 - Usd path to rigid body actor 0 decoded into two ints. PhysicsSchemaTools.encodeSdfPath will return SdfPath.
* actor1 - Usd path to rigid body actor 1 decoded into two ints. PhysicsSchemaTools.encodeSdfPath will return SdfPath.
* collider0 - Usd path to collider 0 decoded into two ints. PhysicsSchemaTools.encodeSdfPath will return SdfPath.
* collider1 - Usd path to collider 1 decoded into two ints. PhysicsSchemaTools.encodeSdfPath will return SdfPath.
* stage_id - Stage that the report is coming from.
* contact_data_offset - Offset to the contact data array.
* num_contact_data - Number of contacts in the contact data array for this header.

The actual contact data are in the second array. Contact data contains this information:

* position - Contact position.
* normal - Contact normal.
* impulse - Contact impulse.
* separation - Separation value for collisions.
* face_index0 - Face index of the collider0 (filled only if available 0xFFFFFFFF otherwise).
* face_index1 - Face index of the collider1 (filled only if available 0xFFFFFFFF otherwise).
* material0 - Material of collider0.
* material1 - Material of collider1.

The following code will not execute and is just kept here as a guidance. Instead of copy pasting the snippet code please have a look at the Physics Demo Sample - contactReportDemo.

from omni.physx.scripts.physicsUtils import *
from pxr import Usd, UsdGeom, Sdf, Gf, Tf, Vt, UsdPhysics, PhysxSchema
from omni.physx._physx import SimulationEvent
from omni.physx import get_physx_interface


# acquire the physx interface
self._physx = _physx.acquire_physx_interface()

# subscribe to physics contact report event, this callback issued after each simulation step
self._contact_report_sub = get_physx_simulation_interface().subscribe_contact_report_events(self._on_contact_report_event)

# Spheres
spherePath = "/sphere"

radius = 30.0
position = Gf.Vec3f(0.0, 0.0, 800.0)
orientation = Gf.Quatf(1.0)
color = Gf.Vec3f(71.0 / 255.0, 165.0 / 255.0, 1.0)
density = 1000.0
linvel = Gf.Vec3f(0.0)

add_rigid_sphere(stage, spherePath, radius, position, orientation, color, density, linvel, Gf.Vec3f(0.0))

# apply contact report
spherePrim = stage.GetPrimAtPath(spherePath)
contactReportAPI = PhysxSchema.PhysxContactReportAPI.Apply(spherePrim)
contactReportAPI.CreatePhysxContactReportThresholdAttr().Set(200000)

def _on_contact_report_event(self, contact_headers, contact_data):
    for contact_header in contact_headers:
        print("Got contact header type: " + str(contact_header.type))
        print("Actor0: " + str(PhysicsSchemaTools.intToSdfPath(contact_header.actor0)))
        print("Actor1: " + str(PhysicsSchemaTools.intToSdfPath(contact_header.actor1)))
        print("Collider0: " + str(PhysicsSchemaTools.intToSdfPath(contact_header.collider0)))
        print("Collider1: " + str(PhysicsSchemaTools.intToSdfPath(contact_header.collider1)))
        print("StageId: " + str(contact_header.stage_id))
        print("Number of contacts: " + str(contact_header.num_contact_data))

        contact_data_offset = contact_header.contact_data_offset
        num_contact_data = contact_header.num_contact_data

        for index in range(contact_data_offset, contact_data_offset + num_contact_data, 1):
            print("Contact:")
            print("Contact position: " + str(contact_data[index].position))
            print("Contact normal: " + str(contact_data[index].normal))
            print("Contact impulse: " + str(contact_data[index].impulse))
            print("Contact separation: " + str(contact_data[index].separation))
            print("Contact faceIndex0: " + str(contact_data[index].face_index0))
            print("Contact faceIndex1: " + str(contact_data[index].face_index1))
            print("Contact material0: " + str(PhysicsSchemaTools.intToSdfPath(contact_data[index].material0)))
            print("Contact material1: " + str(PhysicsSchemaTools.intToSdfPath(contact_data[index].material1)))

Multiple Physics Scenes

Physics simulation does support multiple Physics Scenes. By default the first PhysicsScene found during traversal is used for the simulation. However it is possible to specify where individual actors should be simulated. RigidBodyAPI and CollisionAPI do have simulationOwner relationship that defines the owner of the rigid body. This defines where the body is simulated. Note that objects in physics scenes do not collide between each other.

Dynamic Rigid Bodies

Dynamic rigid bodies can have multiple owners (PhysicsScene), however only one can own it. The first rel defines the scene where the body is simulated as a dynamic body. It is then mirrored to the other scenes as a kinematic body.

Static Rigid Bodies

Static rigid bodies can have multiple owners (PhysicsScene), the same static body is mirrored to all the scenes that are defined in the simulationOwner rel.

Scene Queries

Scene queries allow you to gather information about the current scene state by using the same computations and data as what is used for simulating collisions. For the same reason, they only work during simulation.

In general they function by determining which colliders in the scene intersects or overlaps with the input shape, and come in three overall variants: Overlap, Raycast, and Sweep. Each type then exist in a number of subvariants that return a single result or multiple results.

Overlap

Overlap scene queries are the most forward types and will tell you whether and what colliders overlap with the input geometry. There are unique function variants for box, sphere, shape (UsdGeom.GPrim) and mesh (UsdGeom.Mesh).

Each of these come in subvariants that exclusively report whether any collider overlap at all (the “any”) and with subvariants that provide detailed information on each detected overlap. For the latter, this is handled by passing an input callback function, in which you can process the information for each individual detected overlap (supplied as a OverlapHit object). With the callback function, you can also control whether to continue or stop the query at the specific overlap by setting the function return value.

Example code:

from omni.physx import get_physx_scene_query_interface

body_prim_found = False
body_prim_path = "/World/BodyPrim"

def report_overlap(overlap):
    if overlap.rigid_body == prim_path:
        global prim_found
        prim_found = True
        # Now that we have found our prim, return False to abort further search.
        return False
    return True

origin = carb.Float3(0.0, 0.0, 50.0)
extent = carb.Float3(100.0, 100.0, 100.0)
rotation = carb.Float4(0.0, 0.0, 0.0, 1.0)

get_physx_scene_query_interface().overlap_box(extent, origin, rotation, report_overlap, False)
if prim_found:
    print("Prim overlapped box!")

The OverlapHit object has the following attributes:

  • collision - Path string to the collider that overlapped

  • collision_encoded - Encoded SdfPath to the collider that overlapped. PhysicsSchemaTools.decodeSdfPath will return SdfPath.

  • rigid_body - Path string to the rigid body that overlapped.

  • rigid_body_encoded - Encoded SdfPath to the rigid body that overlapped. PhysicsSchemaTools.decodeSdfPath will return SdfPath

  • protoIndex - ProtoIndex, filled for pointInstancers otherwise 0xFFFFFFFF

Raycast

Raycast scene queries allow you to detect any colliders that intersect with the input ray. In addition to providing the same information as the Overlap queries, it also provides detailed data on the exact points of intersection.

Example code:

from omni.physx import get_physx_scene_query_interface

body_prim_found = False
body_prim_path = "/World/BodyPrim"
hit_position = carb.Float3(0.0, 0.0, 0.0)

def report_raycast(hit):
    if hit.rigid_body == body_prim_path:
        global body_prim_found
        body_prim_found = True
        global hit_position
        hit_position = hit.position
        # Now that we have found our prim, return False to abort further search.
        return False
    return True

origin = carb.Float3(0.0, 1000.0, 0.0)
direction = carb.Float3(0.0, -1.0, 0.0)
distance = 1000.0
rotation = carb.Float4(0.0, 0.0, 0.0, 1.0)

get_physx_scene_query_interface().raycast_all(origin, direction, distance, report_raycast)
if body_prim_found:
    print(f"Body prim was hit by ray at {hit_position}!")

The RaycastHit object has the following attributes:

  • collision - Path string to the collider that was hit

  • collision_encoded - Encoded SdfPath to the collider that was hit. PhysicsSchemaTools.decodeSdfPath will return SdfPath.

  • rigid_body - Path string to the rigid body that was hit.

  • rigid_body_encoded - Encoded SdfPath to the rigid body that was hit. PhysicsSchemaTools.decodeSdfPath will return SdfPath

  • protoIndex - ProtoIndex, filled for pointInstancers otherwise 0xFFFFFFFF

  • distance - Hit location distance.

  • face_index - Hit location face index.

  • material - Path string to the collider material that was hit.

  • material_encoded - Encoded SdfPath to the collider material that was hit. PhysicsSchemaTools.decodeSdfPath will return SdfPath.

  • normal - Hit location normal.

  • position - Hit location position.

Raycasting also features a subvariant that only returns information of the closest intersection in the form of a dictionary. This is an example of using this variant:

Example code:

from omni.physx import get_physx_scene_query_interface

origin = carb.Float3(0.0, 1000.0, 0.0)
direction = carb.Float3(0.0, -1.0, 0.0)
distance = 1000.0
rotation = carb.Float4(0.0, 0.0, 0.0, 1.0)

hit_info = get_physx_scene_query_interface().raycast_closest(origin, direction, distance)
if hit_info['hit']:
    print(f"{hit_info['rigidBody']} was hit by ray at {hit_info['position']}!")

The returned dictionary includes the following data (notice the minor variations from RaycastHit objects):

  • hit - True if a hit was found, otherwise False.

  • collision - Path string to the collider that was hit

  • rigidBody - Path string to the rigid body that was hit.

  • protoIndex - ProtoIndex, filled for pointInstancers otherwise 0xFFFFFFFF

  • distance - Hit location distance.

  • faceIndex - Hit location face index.

  • material - Path string to the collider material that was hit.

  • normal - Hit location normal.

  • position - Hit location position.

Sweep

Sweep is almost identical to raycast, except that rather than just doing an intersection check against a line, you input an additional sphere radius for the check. The sweep scene query will then return intersection information corresponding to if you moved (or swept) a sphere along the direction you input.

Example code:

from omni.physx import get_physx_scene_query_interface

body_prim_found = False
body_prim_path = "/World/BodyPrim"
hit_position = carb.Float3(0.0, 0.0, 0.0)

def report_sweep(hit):
    if hit.rigid_body == body_prim_path:
        global body_prim_found
        body_prim_found = True
        global hit_position
        hit_position = hit.position
        # Now that we have found our prim, return False to abort further search.
        return False
    return True

radius = 100.0
origin = carb.Float3(0.0, 1000.0, 0.0)
direction = carb.Float3(0.0, -1.0, 0.0)
distance = 1000.0
rotation = carb.Float4(0.0, 0.0, 0.0, 1.0)

get_physx_scene_query_interface().sweep_sphere_all(radius, origin, direction, distance, report_sweep)
if body_prim_found:
    print(f"Body was hit by sweep at {hit_position}!")

The return values of the sweep scene queries are identical to those of the corresponding Raycast queries.

Python Bindings API

This module contains python bindings to the C++ omni::physx interface. Omni::physx contains several interfaces:

PhysX -- Main interface used for physics simulation.
PhysXVisualization -- Interface for debug visualization control.
PhysXUnitTests -- Interface for unit tests.
class omni.physx.bindings._physx.ContactData

Contact data.

property face_index0

Face index 0 - non zero only for meshes

property face_index1

Face index 1 - non zero only for meshes.

property impulse

Contact impulse

property material0

Material0 - uint64 use PhysicsSchemaTools::intToSdfPath to convert to SdfPath.

property material1

Material1 - uint64 use PhysicsSchemaTools::intToSdfPath to convert to SdfPath.

property normal

Contact normal.

property position

Contact position.

property separation

Contact separation value.

class omni.physx.bindings._physx.ContactDataVector
append(self: omni.physx.bindings._physx.ContactDataVector, x: omni.physx.bindings._physx.ContactData) None

Add an item to the end of the list

clear(self: omni.physx.bindings._physx.ContactDataVector) None

Clear the contents

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: omni.physx.bindings._physx.ContactDataVector, L: omni.physx.bindings._physx.ContactDataVector) -> None

Extend the list by appending all the items in the given list

  1. extend(self: omni.physx.bindings._physx.ContactDataVector, L: Iterable) -> None

Extend the list by appending all the items in the given list

insert(self: omni.physx.bindings._physx.ContactDataVector, i: int, x: omni.physx.bindings._physx.ContactData) None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: omni.physx.bindings._physx.ContactDataVector) -> omni.physx.bindings._physx.ContactData

Remove and return the last item

  1. pop(self: omni.physx.bindings._physx.ContactDataVector, i: int) -> omni.physx.bindings._physx.ContactData

Remove and return the item at index i

class omni.physx.bindings._physx.ContactEventHeader

Contact event header.

property actor0

Actor0 - uint64 use PhysicsSchemaTools::intToSdfPath to convert to SdfPath.

property actor1

Actor1 - uint64 use PhysicsSchemaTools::intToSdfPath to convert to SdfPath.

property collider0

Collider0 - uint64 use PhysicsSchemaTools::intToSdfPath to convert to SdfPath.

property collider1

Collider1 - uint64 use PhysicsSchemaTools::intToSdfPath to convert to SdfPath.

property contact_data_offset

Contact data offset.

property num_contact_data

Number of contact data.

property proto_index0

Protoindex0 from a point instancer (0xFFFFFFFF means collider is not part of an instancer).

property proto_index1

Protoindex1 from a point instancer (0xFFFFFFFF means collider is not part of an instancer).

property stage_id

Stage id.

property type

Contact event type.

class omni.physx.bindings._physx.ContactEventHeaderVector
append(self: omni.physx.bindings._physx.ContactEventHeaderVector, x: omni.physx.bindings._physx.ContactEventHeader) None

Add an item to the end of the list

clear(self: omni.physx.bindings._physx.ContactEventHeaderVector) None

Clear the contents

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: omni.physx.bindings._physx.ContactEventHeaderVector, L: omni.physx.bindings._physx.ContactEventHeaderVector) -> None

Extend the list by appending all the items in the given list

  1. extend(self: omni.physx.bindings._physx.ContactEventHeaderVector, L: Iterable) -> None

Extend the list by appending all the items in the given list

insert(self: omni.physx.bindings._physx.ContactEventHeaderVector, i: int, x: omni.physx.bindings._physx.ContactEventHeader) None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: omni.physx.bindings._physx.ContactEventHeaderVector) -> omni.physx.bindings._physx.ContactEventHeader

Remove and return the last item

  1. pop(self: omni.physx.bindings._physx.ContactEventHeaderVector, i: int) -> omni.physx.bindings._physx.ContactEventHeader

Remove and return the item at index i

class omni.physx.bindings._physx.ContactEventType

Contact event type.

Members:

CONTACT_FOUND : Contact found.

CONTACT_LOST : Contact lost.

CONTACT_PERSIST : Contact persist.

CONTACT_FOUND = <ContactEventType.CONTACT_FOUND: 0>
CONTACT_LOST = <ContactEventType.CONTACT_LOST: 1>
CONTACT_PERSIST = <ContactEventType.CONTACT_PERSIST: 2>
property name
property value
class omni.physx.bindings._physx.ErrorEvent

Error events used by physics error event stream.

Members:

USD_LOAD_ERROR : Usd load error, event has dictionary with key ‘errorString’:string

PHYSX_ERROR : PhysX runtime error, event has dictionary with key ‘errorString’:string

PHYSX_TOO_MANY_ERRORS : PhysX exceeded maximum number of reported errors, event has dictionary with key ‘errorString’:string

PHYSX_CUDA_ERROR : PhysX GPU Cuda error, event has dictionary with key ‘errorString’:string

PHYSX_CUDA_ERROR = <ErrorEvent.PHYSX_CUDA_ERROR: 2>
PHYSX_ERROR = <ErrorEvent.PHYSX_ERROR: 1>
PHYSX_TOO_MANY_ERRORS = <ErrorEvent.PHYSX_TOO_MANY_ERRORS: 3>
USD_LOAD_ERROR = <ErrorEvent.USD_LOAD_ERROR: 0>
property name
property value
class omni.physx.bindings._physx.IPhysxAttachment

This interface is the access point to the omni.physx attachment functionality.

add_surface_sampler_points(self: omni.physx.bindings._physx.IPhysxAttachment, surface_sampler: int, points: List[carb._carb.Float3]) None

Add samples to surface sampler.

Parameters
  • surface_sampler – Handle to surface sampler

  • points – Points to add

This function adds samples to the surface sampler that are then considered for further sampling.

compute_attachment_points(self: omni.physx.bindings._physx.IPhysxAttachment, attachment_path: str) bool

Compute attachment points

Parameters

attachment_path – path to PhysxSchema.PhysxPhysicsAttachment primitive with PhysxSchema.PhysxAutoAttachmentAPI

create_point_finder(self: omni.physx.bindings._physx.IPhysxAttachment, points: List[carb._carb.Float3]) int

Create point finder.

Parameters

points – Points of the mesh

Returns

Handle to point finder

create_surface_sampler(self: omni.physx.bindings._physx.IPhysxAttachment, collider_path: str, sampling_distance: float) int

Create surface Poisson sampler.

Parameters
  • collider_path – Path to prim with UsdPhysics.CollisionAPI

  • sampling_distance – Distance used for sampling points

Returns

Handle to surface sampler

create_tet_finder(self: omni.physx.bindings._physx.IPhysxAttachment, points: List[carb._carb.Float3], indices: List[int]) int

Create tet finder.

Parameters
  • points – Points of the tetrahedral mesh

  • indices – Indices of the tetrahedral mesh

Returns

Handle to tet finder

create_tri_mesh_sampler(self: omni.physx.bindings._physx.IPhysxAttachment, surface_sampler: int) None

Get closest points to the input points on the prim

Parameters
  • points – input points

  • path – prim path

Returns

Return a dictionary with closest information:

'closest_points': float3 - Closest points to the input points on the prim. Only valid when returned distance is strictly positive.
'dists': float - Square distances between the points and the geom object. 0.0 if the point is inside the object.

get_closest_points(self: omni.physx.bindings._physx.IPhysxAttachment, point: List[carb._carb.Float3], path: str) dict

Get closest points to the input points on the prim

Parameters
  • points – input points

  • path – prim path

Returns

Return a dictionary with closest information:

'closest_points': float3 - Closest points to the input points on the prim. Only valid when returned distance is strictly positive.
'dists': float - Square distances between the points and the geom object. 0.0 if the point is inside the object.

get_surface_sampler_points(self: omni.physx.bindings._physx.IPhysxAttachment, surface_sampler: int) dict

Get the samples of surface sampler.

Parameters

surface_sampler – Handle to surface sampler

Returns

Dict mapping ‘points’ to the resulting sampling points

is_point_inside(self: omni.physx.bindings._physx.IPhysxAttachment, surface_sampler: int, point: carb._carb.Float3) bool

Get closest points to the input points on the prim

Parameters
  • points – input points

  • path – prim path

Returns

Return a dictionary with closest information:

'closest_points': float3 - Closest points to the input points on the prim. Only valid when returned distance is strictly positive.
'dists': float - Square distances between the points and the geom object. 0.0 if the point is inside the object.

overlap_tetmesh_capsule(self: omni.physx.bindings._physx.IPhysxAttachment, tet_finder: int, pos: carb._carb.Float3, axis: carb._carb.Float3, radius: float, half_height: float) dict

Finds all tetrahedra overlapping with a capsule.

Parameters
  • tet_finder – Handle to tet finder

  • pos – Position of capsule

  • axis – Orientation of the capsule

  • radius – Radius of the capsule

  • capsule (half_height Half height of the) –

Returns

Dict mapping ‘tet_ids’ to the resulting indices of tetrahedra overlapping with the capsule.

overlap_tetmesh_sphere(self: omni.physx.bindings._physx.IPhysxAttachment, tet_finder: int, center: carb._carb.Float3, radius: float) dict

Finds all tetrahedra overlapping with a sphere.

Parameters
  • tet_finder – Handle to tet finder

  • center – Center of sphere

  • radius – Radius of sphere

Returns

Dict mapping ‘tet_ids’ to the resulting indices of tetrahedra overlapping with the sphere.

points_to_indices(self: omni.physx.bindings._physx.IPhysxAttachment, point_finder: int, points: List[carb._carb.Float3]) dict

Map points to indices.

Parameters
  • point_finder – Handle to point finder

  • points – Points to be mapped

Returns

Dict mapping ‘indices’ to the resulting mesh coordinates. Indices might be -1 for points outside of the mesh.

points_to_tetmesh_local(self: omni.physx.bindings._physx.IPhysxAttachment, tet_finder: int, points: List[carb._carb.Float3]) dict

Map points in euclidean coordiantes to tet mesh coordinates.

Parameters
  • tet_finder – Handle to tet finder

  • points – Points to be mapped

Returns

Dict mapping ‘tet_ids’ and ‘barycentric_coords’ to the resulting local tet mesh coordinates. Tet indices might be -1 for points outside of the tetrahedral mesh.

release_point_finder(self: omni.physx.bindings._physx.IPhysxAttachment, point_finder: int) None

Release point finder.

Parameters

point_finder – Handle to point finder

release_surface_sampler(self: omni.physx.bindings._physx.IPhysxAttachment, surface_sampler: int) None

Release surface Poisson sampler.

Parameters

surface_sampler – Handle to surface sampler

release_tet_finder(self: omni.physx.bindings._physx.IPhysxAttachment, tet_finder: int) None

Release tet finder.

Parameters

tet_finder – Handle to tet finder

remove_surface_sampler_points(self: omni.physx.bindings._physx.IPhysxAttachment, surface_sampler: int, points: List[carb._carb.Float3]) None

Remove samples from surface sampler.

Parameters
  • surface_sampler – Handle to surface sampler

  • points – Points to remove

This function removes samples from the surface sampler.

sample_surface(self: omni.physx.bindings._physx.IPhysxAttachment, surface_sampler: int, sphere_center: carb._carb.Float3, sphere_radius: float, sampling_distance: float) dict

Create new surface samples within specified sphere.

Parameters
  • surface_sampler – Handle to surface sampler

  • sphere_center – Center of sphere used for restricting sampling domain

  • sphere_radius – Radius of sphere used for restricting sampling domain

Returns

Dict mapping ‘points’ to the resulting sampling points

New samples are created on the surface for which the samples has been created, and within the sphere specified.

tetmesh_local_to_points(self: omni.physx.bindings._physx.IPhysxAttachment, tet_finder: int, tet_ids: List[int], barycentric_coords: List[carb._carb.Float4]) dict

Map tet mesh coordinates to points in euclidean coordinates.

Parameters
  • tet_finder – Handle to tet finder

  • tet_ids – Tetrahedra indices

  • barycentric_coords – Barycentric coordinates

Returns

Dict mapping ‘points’ to the resulting points in euclidean coordinates.

class omni.physx.bindings._physx.IPhysxBenchmarks

This interface is the access point to the omni.physx benchmarks.

enable_profile(self: omni.physx.bindings._physx.IPhysxBenchmarks, enable_profile: bool) None

Enabled profiling :param enable_profile: Do custom physics profiling

get_profile_stats(self: omni.physx.bindings._physx.IPhysxBenchmarks) dict

Get profiling stats

class omni.physx.bindings._physx.IPhysxPropertyQuery
query_prim(self: omni.physx.bindings._physx.IPhysxPropertyQuery, stage_id: int, prim_id: int, query_mode: omni.physx.bindings._physx.PhysxPropertyQueryMode = <PhysxPropertyQueryMode.QUERY_RIGID_BODY_WITH_COLLIDERS: 0>, timeout_ms: int = -1, finished_fn: Callable[[], None] = None, rigid_body_fn: Callable[[omni.physx.bindings._physx.PhysxPropertyQueryRigidBodyResponse], None] = None, collider_fn: Callable[[omni.physx.bindings._physx.PhysxPropertyQueryColliderResponse], None] = None) None

Returns information for given prim

Parameters
  • stage_id – uint64_t Stage id

  • prim_id – uint64_t USD path (use PhysicsSchemaTools::sdfPathToInt)

  • query_mode – PhysxPropertyQueryMode Type of query to be made

  • timeout_ms – int64 Timeout (in milliseconds) for the request. (-1 means wait forever)

  • finished_fn – function Report function called when enumeration of all objects is finished

  • rigid_body_fn – function Report function where rigid body information will be returned in PhysxPropertyQueryRigidBodyResponse object

  • collider_fn – function Report function where collider information will be returned in PhysxPropertyQueryRigidBodyResponse object

class omni.physx.bindings._physx.IPhysxReplicator
register_replicator(self: omni.physx.bindings._physx.IPhysxReplicator, stage_id: int, replicator_attach_fn: Callable[[int], list], replicator_attach_end_fn: Callable[[int], None], hierarchy_rename_fn: Callable[[str, int], str]) None

Register replicator for given stage.

stage_id: current stageId

replicator_attach_fn: std::function<py::list(uint64_t stageId)>;

replicator_attach_end_fn: std::function<py::list(uint64_t stageId)>;

hierarchy_rename_fn: std::function<const char* (const char* replicatePath, uint32_t index)>;

replicate(self: omni.physx.bindings._physx.IPhysxReplicator, stage_id: int, path: str, numReplications: int) bool

Replicate hierarchy.

stage_id: stage id path: path to replicate numReplications: number of replications

unregister_replicator(self: omni.physx.bindings._physx.IPhysxReplicator, stage_id: int) None

Unregister replicator from stage.

class omni.physx.bindings._physx.IPhysxSimulation

This interface is the access point to the omni.physx simulation control.

apply_force_at_pos(self: omni.physx.bindings._physx.IPhysxSimulation, stage_id: int, body_path: int, force: carb._carb.Float3, pos: carb._carb.Float3, mode: str = 'Force') None

Applies force at given body with given force position.

Parameters
  • stage_id – USD stageId

  • body_path – USD path of the body encoded in uint64_t use PhysicsSchemaTools::sdfPathToInt

  • force – Force to apply to the body.

  • pos – World position where the force is applied.

  • mode – Supporting various modes - Force (default), Impulse, Velocity, Acceleration.

apply_torque(self: omni.physx.bindings._physx.IPhysxSimulation, stage_id: int, body_path: int, torque: carb._carb.Float3) None

Applies torque at given body at body center of mass

Parameters
  • stage_id – USD stageId

  • body_path – USD path of the body encoded in uint64_t use PhysicsSchemaTools::sdfPathToInt

  • torque – Torque to apply to the body.

attach_stage(self: omni.physx.bindings._physx.IPhysxSimulation, stage_id: int) bool

Attach USD stage. This will run the physics parser and will populate the PhysX SDK with the corresponding simulation objects.

Note: previous stage will be detached.

Parameters

stage_id – USD stageId (can be retrieved from a stagePtr - UsdUtils.StageCache.Get().GetId(stage).ToLongInt())

Returns

Returns true if stage was successfully attached.

check_results(self: omni.physx.bindings._physx.IPhysxSimulation) bool

Check if simulation finished.

Returns

Returns true if simulation has finished.

check_results_scene(self: omni.physx.bindings._physx.IPhysxSimulation, scene_path: int) bool

Check if a simulation scene is finished. Disabling a scene has no effect on this function. If scenePath is empty, it behaves like IPhysxSimulation::checkResults

Returns True if the simulation scene is finished.

scenePath uint64_t Scene USD path use PhysicsSchemaTools::sdfPathToInt

detach_stage(self: omni.physx.bindings._physx.IPhysxSimulation) None

Detach USD stage, this will remove all objects from the PhysX SDK

fetch_results(self: omni.physx.bindings._physx.IPhysxSimulation) None

Fetch simulation results. Writing out simulation results based on physics settings.

Note This is a blocking call. The function will wait until the simulation is finished.

fetch_results_scene(self: omni.physx.bindings._physx.IPhysxSimulation, scene_path: int) None

Fetch simulation scene results and writes out simulation results based on physics settings for a specific scene. Disabling a scene has no effect on this function. If scenePath is empty, it behaves like IPhysxSimulation::fetchResults

Note: this is a blocking call. The function will wait until the simulation scene is finished.

scenePath uint64_t Scene USD path use PhysicsSchemaTools::sdfPathToInt

flush_changes(self: omni.physx.bindings._physx.IPhysxSimulation) None

Flush changes will force physics to process buffered changes

Changes to physics gets buffered, in some cases flushing changes is required if order is required.

Example - prim A gets added. Existing prim B has a relationship that gets switched to use A. Currently, the relationship change gets processed immediately and fails because prim A only gets added at the start of the next sim step.

get_contact_report(self: omni.physx.bindings._physx.IPhysxSimulation) tuple

Get contact report data for current simulation step directly.

The contact buffer data are available for one simulation step

Returns

Tuple with contact event vector and contact data vector:

'contact_headers': vector of contact event headers
'contact_data': vector of contact data

is_change_tracking_paused(self: omni.physx.bindings._physx.IPhysxSimulation) bool

Check if fabric change tracking for physics listener is paused or not

Returns true if paused change tracking.

is_sleeping(self: omni.physx.bindings._physx.IPhysxSimulation, stage_id: int, body_path: int) bool

Is body sleeping.

Parameters
  • stage_id – USD stageId

  • body_path – USD path of the body encoded in uint64_t use PhysicsSchemaTools::sdfPathToInt

Returns

True if body is asleeep

pause_change_tracking(self: omni.physx.bindings._physx.IPhysxSimulation, pause: bool) None

Pause fabric change tracking for physics listener.

Parameters

tracking. (pause bool Pause or unpause change) –

put_to_sleep(self: omni.physx.bindings._physx.IPhysxSimulation, stage_id: int, body_path: int) None

Put body to sleep.

Parameters
  • stage_id – USD stageId

  • body_path – USD path of the body encoded in uint64_t use PhysicsSchemaTools::sdfPathToInt

simulate(self: omni.physx.bindings._physx.IPhysxSimulation, elapsed_time: float, current_time: float) None

Execute physics asynchronous simulation.

Parameters
  • elapsed_time – Simulation time in seconds.

  • current_time – Current time, might be used for time sampled transformations to apply.

simulate_scene(self: omni.physx.bindings._physx.IPhysxSimulation, scene_path: int, elapsed_time: float, current_time: float) None

Execute the physics simulation on a specific scene.

The PhysX simulation in the scene will simulate the exact elapsedTime passed. No substepping will happen. It is the caller’s responsibility to provide a reasonable elapsedTime. In general it is recommended to use fixed size time steps with a maximum of 1/60 of a second. If scenePath is empty, it behaves like IPhysxSimulation::simulate

scenePath uint64_t Scene USD path use PhysicsSchemaTools::sdfPathToInt elapsedTime float Simulation time in seconds. currentTime float Current time, might be used for time sampled transformations to apply.

subscribe_contact_report_events(self: omni.physx.bindings._physx.IPhysxSimulation, fn: Callable[[omni.physx.bindings._physx.ContactEventHeaderVector, omni.physx.bindings._physx.ContactDataVector], None]) carb._carb.Subscription

Subscribes to contact report callback function.

The contact buffer data are available for one simulation step

Parameters

fn – The callback to be called after simulation step to receive contact reports.

Returns

The subscription holder.

subscribe_physics_trigger_report_events(self: omni.physx.bindings._physx.IPhysxSimulation, trigger_report_fn: Callable[[omni.physx.bindings._physx.TriggerEventData], None], stage_id: int = 0, prim_id: int = 0) int

Register for trigger notifications

Parameters
  • trigger_report_fn – function Report function where enter or leave trigger events will be notified

  • stage_id – uint64_t [Optional] Stage id to filter triggers from

  • prim_id – uint64_t [Optional] USD path to filter triggers from (use PhysicsSchemaTools::sdfPathToInt)

Returns

SubscriptionId Subscription Id that can be unregistered with unsubscribe_physics_trigger_report_events

Return type

subscription_id

unsubscribe_physics_trigger_report_events(self: omni.physx.bindings._physx.IPhysxSimulation, subscriptionId: int) None

Unregister a subscription for trigger notifications

Parameters

subscription_id – SubscriptionId Subscription Id

wake_up(self: omni.physx.bindings._physx.IPhysxSimulation, stage_id: int, body_path: int) None

Wake up body.

Parameters
  • stage_id – USD stageId

  • body_path – USD path of the body encoded in uint64_t use PhysicsSchemaTools::sdfPathToInt

class omni.physx.bindings._physx.OverlapHit

Sweep hit results structure.

class omni.physx.bindings._physx.ParticleVisualizationPositionType

Particle position debug visualiztion option for smoothed fluid particles for use with SETTING_DISPLAY_PARTICLES_POSITION_TYPE.

SIM_POSITIONS = 0
SMOOTHED_POSITIONS = 1
class omni.physx.bindings._physx.ParticleVisualizationRadiusType

Particle radius debug visualization option for use with SETTING_DISPLAY_PARTICLES_RADIUS_TYPE.

ANISOTROPY = 4
CONTACT_OFFSET = 0
PARTICLE_CONTACT_OFFSET = 2
PARTICLE_REST_OFFSET = 3
RENDER_GEOMETRY = 5
REST_OFFSET = 1
class omni.physx.bindings._physx.PhysX

This interface is the main access point to omni.physx extension. It contains functions that can control the simulation, modify the simulation or work directly with physics objects.

apply_force_at_pos(self: omni.physx.bindings._physx.PhysX, body_path: str, force: carb._carb.Float3, pos: carb._carb.Float3, mode: str = 'Force') None

Applies force at given body with given force position.

Deprecated, please use apply_force_at_pos at physx_simulation_interface

Parameters
  • body_path – USD path of the body.

  • force – Force to apply to the body.

  • pos – World position where the force is applied.

  • mode – Supporting various modes - Force (default), Impulse, Velocity, Acceleration.

cancel_collision_tasks(self: omni.physx.bindings._physx.PhysX) int

Returns the number of active collision cooking tasks which were canceled

check_backwards_compatibility(self: omni.physx.bindings._physx.PhysX, stage_id: int = - 1) bool

Checks for occurrences of any old schema format.

compute_vehicle_velocity(self: omni.physx.bindings._physx.PhysX, path: str, direction: carb._carb.Float3) float

Get the linear velocity of a vehicle (vehicle prim needs to have vehicle API applied).

Note

Should only be called after the simulation has been started.

Parameters
  • path – Vehicle USD path.

  • direction – carb.Float3: Unit length direction vector along which the linear velocity should get computed. The vector is considered to be relative to the center of mass frame of the vehicle. If None is passed in, then the local forward direction of the vehicle will be used.

Returns

The velocity along the provided direction vector.

force_load_physics_from_usd(self: omni.physx.bindings._physx.PhysX) None

Forces load physics objects from USD into PhysX. By default physics is not loaded; this function forces a load of all physics from USD into PhysX.

get_backwards_compatibility_check_log(self: omni.physx.bindings._physx.PhysX) str

Get backwards compatibility check log. Valid for last run of backward compatibility check.

get_error_event_stream(self: omni.physx.bindings._physx.PhysX) carb::events::IEventStream

Error event stream sending various error events defined in ErrorEvent enum.

Returns

Event stream sending the physics errors.

get_num_collision_tasks(self: omni.physx.bindings._physx.PhysX) int

Returns the number of active collision cooking tasks

get_overwrite_gpu_setting(self: omni.physx.bindings._physx.PhysX) int

Get CPU vs GPU simulation settings.

Returns

-1 - use setting from schema, 0 - force CPU, 1 - force GPU

Return type

Integer defining the behavior

get_rigidbody_transformation(self: omni.physx.bindings._physx.PhysX, path: str) dict

Gets rigid body current transformation in a global space.

Parameters

path – The USD path to the rigid body.

Returns

Return a dictionary with transformation info:

'ret_val': bool - whether transformation was found
'position': float3 - rigid body position
'rotation': float4 - rigid body rotation (quat - x,y,z,w)

get_simulation_event_stream_v2(self: omni.physx.bindings._physx.PhysX) carb::events::IEventStream

Simulation event stream sending various simulation events defined in SimulationEvent enum.

Returns

Event stream sending the simulation events.

get_vehicle_drive_state(self: omni.physx.bindings._physx.PhysX, path: str) dict

Get the drive state of a vehicle.

Note

Should only be called after the simulation has been started.

Parameters

path – Vehicle USD path.

Returns

A dictionary with the following key, value pairs. An empty dictionary is returned for an invalid path, when the simulation is not running or when the vehicle does not have a Basic or Standard drive type.

VEHICLE_DRIVE_STATE_ACCELERATOR, d (in range [0, 1]),
VEHICLE_DRIVE_STATE_BRAKE0, d (in range [0, 1]),
VEHICLE_DRIVE_STATE_BRAKE1, d (in range [0, 1]),
VEHICLE_DRIVE_STATE_STEER, d (in range [-1, 1]),
VEHICLE_DRIVE_STATE_CLUTCH, d (in range [0, 1], only applicable to PhysxVehicleDriveStandard drive type),
VEHICLE_DRIVE_STATE_CURRENT_GEAR, i (only applicable to PhysxVehicleDriveStandard drive type),
VEHICLE_DRIVE_STATE_TARGET_GEAR, i (only applicable to PhysxVehicleDriveStandard drive type),
VEHICLE_DRIVE_STATE_GEAR_SWITCH_TIME, d (in seconds, negative value if no gear shift is in process. Only applicable to PhysxVehicleDriveStandard drive type),
VEHICLE_DRIVE_STATE_AUTOBOX_TIME_SINCE_LAST_SHIFT, d (in seconds, only applicable toPhysxVehicleDriveStandard drive type),
VEHICLE_DRIVE_STATE_ENGINE_ROTATION_SPEED, d (in radians per second, only applicable to PhysxVehicleDriveStandard drive type),
VEHICLE_DRIVE_STATE_AUTOMATIC_TRANSMISSION, i (only applicable to PhysxVehicleDriveStandard drive type)

get_wheel_state(self: omni.physx.bindings._physx.PhysX, path: str) dict

Get the wheel state.

Note

Should only be called after the simulation has been started.

Parameters

path – Wheel attachment USD path.

Returns

A dictionary with the following key, value pairs. An empty dictionary is returned for an invalid path.

VEHICLE_WHEEL_STATE_LOCAL_POSE_POSITION, (d, d, d),
VEHICLE_WHEEL_STATE_LOCAL_POSE_QUATERNION, (d, d, d, d)
VEHICLE_WHEEL_STATE_ROTATION_SPEED, d (in radians per second),
VEHICLE_WHEEL_STATE_ROTATION_ANGLE, d (in radians),
VEHICLE_WHEEL_STATE_STEER_ANGLE, d (in radians),
VEHICLE_WHEEL_STATE_GROUND_PLANE, (d, d, d, d) (first 3 entries are plane normal n, fourth entry is d of equation dot(n, v) + d = 0). Only valid if wheel is on ground, see VEHICLE_WHEEL_STATE_IS_ON_GROUND,
VEHICLE_WHEEL_STATE_GROUND_ACTOR, string (USD path of the actor prim the wheel is driving on). Only valid if wheel is on ground, see VEHICLE_WHEEL_STATE_IS_ON_GROUND,
VEHICLE_WHEEL_STATE_GROUND_SHAPE, string (USD path of the collider prim the wheel is driving on). Only valid if wheel is on ground, see VEHICLE_WHEEL_STATE_IS_ON_GROUND,
VEHICLE_WHEEL_STATE_GROUND_MATERIAL, string (USD path of the material prim the wheel is driving on). Only valid if wheel is on ground, see VEHICLE_WHEEL_STATE_IS_ON_GROUND,
VEHICLE_WHEEL_STATE_GROUND_HIT_POSITION, (d, d, d) (hit position on the ground in world space). Only valid if wheel is on ground, see VEHICLE_WHEEL_STATE_IS_ON_GROUND,
VEHICLE_WHEEL_STATE_SUSPENSION_JOUNCE, d,
VEHICLE_WHEEL_STATE_SUSPENSION_FORCE, (d, d, d),
VEHICLE_WHEEL_STATE_TIRE_FRICTION, d,
VEHICLE_WHEEL_STATE_TIRE_LONGITUDINAL_DIRECTION, (d, d, d),
VEHICLE_WHEEL_STATE_TIRE_LATERAL_DIRECTION, (d, d, d),
VEHICLE_WHEEL_STATE_TIRE_LONGITUDINAL_SLIP, d,
VEHICLE_WHEEL_STATE_TIRE_LATERAL_SLIP, d,
VEHICLE_WHEEL_STATE_TIRE_FORCE, (d, d, d),
VEHICLE_WHEEL_STATE_IS_ON_GROUND, i, whether the wheel did touch the ground or is in air (=0). If the vehicle is disabled or sleeping then the wheel will be treated as not touching ground too.

is_asyncsimrender_enabled(self: omni.physx.bindings._physx.PhysX) bool

Returns true if asynchronous simulation and rendering is enabled for one of the scenes in the simulation.

is_interactive_actor_raycast(self: omni.physx.bindings._physx.PhysX, arg0: carb._carb.Float3, arg1: carb._carb.Float3) bool

Raycast check to detect interactive physics actors

Note

Only produces positive results during simulation

Parameters
  • origin – carb.Float3: World-space origin of raycast

  • direction – carb.Float3: Unit-length direction vector of raycast

Returns

True if interactive actor is hit; False otherwise, or if simulation is not running

is_readback_suppressed(self: omni.physx.bindings._physx.PhysX) bool

Check if GPU readback is suppressed for currently running simulation.

Returns

True if simulation is running with suppressed readback. Always returns false when simulation is not running.

overwrite_gpu_setting(self: omni.physx.bindings._physx.PhysX, gpuSetting: int) None

Override CPU vs GPU simulation settings.

Parameters

gpuSetting – Integer defining the behavior: -1 - use setting from schema, 0 - force CPU, 1 - force GPU

overwrite_solver_type(self: omni.physx.bindings._physx.PhysX, solverSetting: int) None

Override PhysX solver settings.

Parameters

solverSetting – Integer defining the behavior: -1 - use setting from schema, 0 - force PGS, 1 - force TGS

put_to_sleep(self: omni.physx.bindings._physx.PhysX, body_path: str) None

Put body to sleep.

Deprecated, please use apply_force_at_pos at physx_simulation_interface

Parameters

body_path – USD path of the body.

reconnect_pvd(self: omni.physx.bindings._physx.PhysX) None

Reconnect to PVD (PhysX Visual Debugger)

release_local_mesh_cache(self: omni.physx.bindings._physx.PhysX) None

Release Local Mesh Cache.

release_physics_objects(self: omni.physx.bindings._physx.PhysX) None

Forces release of all physics objects from PhysX.

reset_setting(self: omni.physx.bindings._physx.PhysX, arg0: str) None

Resets all physics settings to their default values.

reset_settings(self: omni.physx.bindings._physx.PhysX) None

Resets all physics settings to their default values.

reset_settings_in_preferences(self: omni.physx.bindings._physx.PhysX) None

Resets physics preferences to their default values.

reset_settings_in_stage(self: omni.physx.bindings._physx.PhysX) None

Resets physics per-stage settings to their default values.

reset_simulation(self: omni.physx.bindings._physx.PhysX) None

Reset physics simulation and set back original transformations stored during start_simulation. This will also remove all data from PhysX.

run_backwards_compatibility(self: omni.physx.bindings._physx.PhysX, stage_id: int = - 1) None

Runs the backwards compatibility code, will try to fix older schema format to a new format.

save_scene_to_repx(self: omni.physx.bindings._physx.PhysX, arg0: str) bool

Save scene to RepX, if scene is not loaded, load scene, save and release.

set_simulation_layer(self: omni.physx.bindings._physx.PhysX, layer: str) None

Sets simulation layer. This layer is used when simulation output transformations are written to USD.

Parameters

layer – The layer that we simulate to.

set_thread_count(self: omni.physx.bindings._physx.PhysX, numThreads: int) None

Sets number of threads for simulation.

Parameters

numThreads – Number of threads that physics should use

set_vehicle_to_rest_state(self: omni.physx.bindings._physx.PhysX, path: str) None

Set the internal dynamics state of a vehicle back to the rest state.

Note

Should only be called after the simulation has been started.

Parameters

path – Vehicle USD path.

set_voxel_range(self: omni.physx.bindings._physx.PhysX, stage_id: int, path: str, sx: int, sy: int, sz: int, ex: int, ey: int, ez: int, type: int, subtype: int, update: int) bool

Set Voxelmap Voxels

Parameters
  • stage_id – Stage containing source mesh primitive.

  • input_path – path to input primitive

  • sx – voxel range start X

  • sy – voxel range start Y

  • sz – voxel range start Z

  • ex – voxel range end X

  • ey – voxel range end Y

  • ez – voxel range end Z

  • type – voxel type

  • sub_type – voxel subtype

  • update – update flag, if zero, writing changes to USD is postponed, if non-zero, all accumulated changes are written to USD

set_wheel_rotation_angle(self: omni.physx.bindings._physx.PhysX, path: str, rotationAngle: float) None

Set the rotation angle about the rolling axis of a wheel.

Note

Should only be called after the simulation has been started.

Parameters
  • path – Wheel attachment USD path.

  • rotationAngle – Rotation angle of the wheel in radians.

set_wheel_rotation_speed(self: omni.physx.bindings._physx.PhysX, path: str, rotationSpeed: float) None

Set the rotation speed about the rolling axis of a wheel.

Note

Should only be called after the simulation has been started.

Parameters
  • path – Wheel attachment USD path.

  • rotationSpeed – Rotation speed of the wheel in radians per second.

start_simulation(self: omni.physx.bindings._physx.PhysX) None

Start simulation, store initial USD data. Call this before manually stepping simulation.

subscribe_object_changed_notifications(self: omni.physx.bindings._physx.PhysX, object_creation_fn: Callable[[int, int, int], None] = None, object_destruction_fn: Callable[[int, int, int], None] = None, all_objects_destruction_fn: Callable[[], None] = None, stop_callback_when_sim_stopped: bool = True) int

Subscribes to Object Changed Notifications

Parameters
  • object_creation_fn – function(path, object_id, physx_type) Notification when a physics object gets created during simulation.

  • object_destruction_fn – function(path, object_id, physx_type) Notification when a physics object gets destroyed during simulation.

  • all_objects_destruction_fn – function Notification when all physics objects get destroyed during simulation.

  • stopCallbackWhenSimStopped – bool Whether these callbacks should not be sent when the simulation stops

Returns

The subscription holder (SubscriptionId) to use with unsubscribe_object_change_notifications

subscribe_physics_step_events(self: omni.physx.bindings._physx.PhysX, fn: Callable[[float], None]) carb._carb.Subscription

Subscribes to physics step events.

Parameters

fn – The callback to be called on every physics step.

Returns

The subscription holder.

unsubscribe_object_change_notifications(self: omni.physx.bindings._physx.PhysX, subscription_id: int) None

Unsubscribes object change notifications with the subscriptionID as returned by subscribe_object_changed_notifications

update_interaction(self: omni.physx.bindings._physx.PhysX, arg0: carb._carb.Float3, arg1: carb._carb.Float3, arg2: omni.physx.bindings._physx.PhysicsInteractionEvent) None

Updates actor interaction based on user input and raycast origin and direction

Note

Only provides interaction during simulation

Parameters
  • origin – carb.Float3: World-space origin of interaction

  • direction – carb.Float3: Unit-length direction vector of interaction

  • event – PhysicsInteractionEvent triggered.

update_simulation(self: omni.physx.bindings._physx.PhysX, elapsedStep: float, currentTime: float) None

Update physics simulation by one step.

Parameters
  • elapsedStep – Simulation step time, time elapsed between last step and this step.

  • currentTime – Current time, might be used for time sampled transformations to apply.

update_simulation_scene(self: omni.physx.bindings._physx.PhysX, scene_path: int, elapsed_step: float, current_time: float) None

Update and step a specific scene in the physics simulation. The specific scene specified in scenePath is updated and stepped even if marked as ‘Disabled’. If scenePath is empty, it behaves like IPhysx::updateSimulation

Parameters
  • scenePath – uint64_t Scene USD path use PhysicsSchemaTools::sdfPathToInt

  • elapsedStep – float Simulation time.

  • currentTime – float Current time, might be used for time sampled transformations to apply.

update_transformations(self: omni.physx.bindings._physx.PhysX, updateToFastCache: bool, updateToUsd: bool, updateVelocitiesToUsd: bool = False, outputVelocitiesLocalSpace: bool = False) None

Update transformations after simulation is done.

Parameters
  • updateToFastCache – Update transformation in fast cache.

  • updateToUsd – Update transformations in USD.

  • updateVelocitiesToUsd – Update velocities in USD.

update_transformations_scene(self: omni.physx.bindings._physx.PhysX, scene_path: int, update_to_usd: bool, update_velocities_to_usd: bool) None

Update the transformations for a specific scene in the physics simulation. The specific scene specified in scenePath has its transformations updated even if it is marked as ‘Disabled’. If scenePath is empty, it behaves like IPhysx::updateTransformations

scenePath uint64_t Scene USD path use PhysicsSchemaTools::sdfPathToInt updateToUsd bool Update transforms to USD. updateVelocitiesToUsd bool Update velocities to USD.

wake_up(self: omni.physx.bindings._physx.PhysX, body_path: str) None

Wake up body.

Deprecated, please use apply_force_at_pos at physx_simulation_interface

Parameters

body_path – USD path of the body.

class omni.physx.bindings._physx.PhysXCooking

This interface is the access point to the omni.physx extension cooking API.

add_prim_to_cooking_refresh_set(self: omni.physx.bindings._physx.PhysXCooking, arg0: pxrInternal_v0_22__pxrReserved__::SdfPath) None

Adds Prim to cooking refresh set.

Parameters

primPath – path to Prim

cancel_collision_tasks(self: omni.physx.bindings._physx.PhysXCooking) int

Returns the number of active collision cooking tasks which were canceled

compute_conforming_tetrahedral_mesh(self: omni.physx.bindings._physx.PhysXCooking, src_tri_points: List[carb._carb.Float3], src_tri_indices: List[int]) dict

Create a conforming tetrahedral mesh from a closed source triangle mesh.

Parameters
  • mesh (src_tri_points Vertices of the source triangle) –

  • triangles (src_tri_indices Vertex indices of the source) –

Returns

Dict mapping ‘points’ and ‘indices’ to the resulting tetrahedral mesh points and indices

The conforming tetrahedral mesh is defined as a tetrahedral mesh whose surface triangles align with the closed source triangle mesh and whose internal vertices lie on the inside of the closed source triangle mesh.

compute_edge_length_limited_triangle_mesh(self: omni.physx.bindings._physx.PhysXCooking, arg0: List[carb._carb.Float3], arg1: List[int], arg2: float) dict

Limits the maximum edge length in a triangle mesh

compute_voxel_tetrahedral_mesh(self: omni.physx.bindings._physx.PhysXCooking, src_tet_points: List[carb._carb.Float3], src_tet_indices: List[int], src_scale: carb._carb.Float3, voxel_resolution: int) dict

Create a voxel tetrahedral mesh from a source tetrahedral mesh.

Parameters
  • src_tet_points – Vertices of teh source tetrahedral mesh

  • src_tet_indices – Vertex indices of the source tetrahedral mesh

  • src_scale – Scale of source mesh used to determine resolution of the resulting voxel mesh

  • voxel_resolution – Number of voxels along longest dimension of axis aligned bounding box of source mesh

Returns

Dict mapping ‘points’ and ‘indices’ to the resulting tetrahedral mesh points and indices

The voxel tetrahedral mesh is made by voxelizing the source tetrahedra on a regular grid. The resulting voxel tetrahedral mesh embeds all tetrahedra of the source mesh. The provided voxel resolution may be lowered automatically in order to match a lower resolution detected in the source mesh. This may help to avoid softbody convergence issues with high-resolution tetrahedra embedding low resolution collision meshes.

cook_deformable_body_mesh(self: omni.physx.bindings._physx.PhysXCooking, deformable_body_path: str) bool

Cooks deformable body mesh

Parameters
  • stage_id – Stage containing source mesh primitive.

  • deformable_body_path – path to UsdGeomMesh with PhysxSchemaPhysxDeformableBodyAPI

get_convex_mesh_data(self: omni.physx.bindings._physx.PhysXCooking, meshPath: str, convexIndex: int) dict

Get convex mesh data for given prim path. (Does work only when simulation is running.)

Returns

Return a dictionary with convex mesh:

'num_vertices': int - number of vertices
'num_polygons': int - number of polygons
'vertices': list - vertices list
'polygons': list - list of dictionaries, dictionary with polygon data::
    'plane' : float4 - Plane format: (mPlane[0],mPlane[1],mPlane[2]).dot(x) + mPlane[3] = 0
    'num_vertices' : int - number of vertices for the current polygon
    'index_base' : int - base index to the indices array
'indices': list - list of indices

get_nb_convex_mesh_data(self: omni.physx.bindings._physx.PhysXCooking, meshPath: str) int

Get number of convex mesh data for given prim path. (Does work only when simulation is running.)

get_num_collision_tasks(self: omni.physx.bindings._physx.PhysXCooking) int

Returns the number of active collision cooking tasks

poisson_sample_mesh(self: omni.physx.bindings._physx.PhysXCooking, mesh_path: str, async: bool) bool

Samples particle positions from mesh

Parameters

mesh_path – path to UsdGeomMesh with PhysxParticleSamplingAPI

release_local_mesh_cache(self: omni.physx.bindings._physx.PhysXCooking) None

Release Local Mesh Cache.

wait_for_cooking_to_finish(self: omni.physx.bindings._physx.PhysXCooking) None

Waits for all cooking tasks to finish.

class omni.physx.bindings._physx.PhysXSceneQuery

This interface is the access point to the omni.physx extension scene query API.

overlap_box(self: omni.physx.bindings._physx.PhysXSceneQuery, halfExtent: carb._carb.Float3, pos: carb._carb.Float3, rot: carb._carb.Float4, reportFn: Callable[[omni.physx.bindings._physx.OverlapHit], bool], anyHit: bool = False) int

Overlap test of a box against objects in the physics scene.

Parameters
  • halfExtent – Box half extent.

  • pos – Origin of the box overlap (barycenter of the box).

  • rot – Rotation of the box overlap (quat x, y, z, w)

  • reportFn – Report function where SceneQueryHits will be reported, return True to continue traversal, False to stop traversal

  • anyHit – Boolean defining whether overlap should report only bool hit (0 no hit, 1 hit found).

Returns

Return number of hits founds

overlap_box_any(self: omni.physx.bindings._physx.PhysXSceneQuery, halfExtent: carb._carb.Float3, pos: carb._carb.Float3, rot: carb._carb.Float4) bool

Overlap test of a box against objects in the physics scene, reports only boolean

Parameters
  • extent – Box extent.

  • pos – Origin of the box overlap.

  • rot – Rotation of the box overlap (quat x, y, z, w)

Returns

Returns True if overlap found

overlap_mesh(self: omni.physx.bindings._physx.PhysXSceneQuery, meshPath0: int, meshPath1: int, reportFn: Callable[[omni.physx.bindings._physx.OverlapHit], bool], anyHit: bool = False) int

Overlap test of a UsdGeom.Mesh against objects in the physics scene. Overlap test will use convex mesh approximation of the input mesh. The first query will need to cook this approximation so if the results are not stored in a local cache, this query might be slow.

Parameters
  • mesh – UsdGeom.Mesh path encoded into two integers. Use PhysicsSchemaTools.encodeSdfPath to get those.

  • reportFn – Report function where SceneQueryHits will be reported, return True to continue traversal, False to stop traversal

  • anyHit – Boolean defining whether overlap should report only bool hit (0 no hit, 1 hit found).

Returns

Return number of hits founds

overlap_mesh_any(self: omni.physx.bindings._physx.PhysXSceneQuery, meshPath0: int, meshPath1: int) bool

Overlap test of a UsdGeom.Mesh against objects in the physics scene. Overlap test will use convex mesh approximation of the input mesh. The first query will need to cook this approximation so if the results are not stored in a local cache, this query might be slow. Reports only boolean.

Parameters

mesh – UsdGeom.Mesh path encoded into two integers. Use PhysicsSchemaTools.encodeSdfPath to get those.

Returns

Returns True if overlap was found.

overlap_shape(self: omni.physx.bindings._physx.PhysXSceneQuery, meshPath0: int, meshPath1: int, reportFn: Callable[[omni.physx.bindings._physx.OverlapHit], bool], anyHit: bool = False) int

Overlap test of a UsdGeom.GPrim against objects in the physics scene. Overlap test will use convex mesh approximation if the input is a mesh. The first query will need to cook this approximation so if the results are not stored in a local cache, this query might be slow.

Parameters
  • gprim – UsdGeom.GPrim path encoded into two integers. Use PhysicsSchemaTools.encodeSdfPath to get those.

  • reportFn – Report function where SceneQueryHits will be reported, return True to continue traversal, False to stop traversal

  • anyHit – Boolean defining whether overlap should report only bool hit (0 no hit, 1 hit found).

Returns

Return number of hits founds

overlap_shape_any(self: omni.physx.bindings._physx.PhysXSceneQuery, meshPath0: int, meshPath1: int) bool

Overlap test of a UsdGeom.GPrim against objects in the physics scene. Overlap test will use convex mesh approximation if the input is a mesh. The first query will need to cook this approximation so if the results are not stored in a local cache, this query might be slow. Reports only boolean.

Parameters

gprim – UsdGeom.GPrim path encoded into two integers. Use PhysicsSchemaTools.encodeSdfPath to get those.

Returns

Returns True if overlap was found.

overlap_sphere(self: omni.physx.bindings._physx.PhysXSceneQuery, radius: float, pos: carb._carb.Float3, reportFn: Callable[[omni.physx.bindings._physx.OverlapHit], bool], anyHit: bool = False) int

Overlap test of a sphere against objects in the physics scene.

Parameters
  • radius – Sphere radius.

  • pos – Origin of the sphere overlap.

  • reportFn – Report function where SceneQueryHits will be reported, return True to continue traversal, False to stop traversal

  • anyHit – Boolean defining whether overlap should report only bool hit (0 no hit, 1 hit found).

Returns

Return number of hits founds

overlap_sphere_any(self: omni.physx.bindings._physx.PhysXSceneQuery, radius: float, pos: carb._carb.Float3) bool

Overlap test of a sphere against objects in the physics scene, reports only boolean.

Parameters
  • radius – Sphere radius.

  • pos – Origin of the sphere overlap.

Returns

Returns True if overlap found.

raycast_all(self: omni.physx.bindings._physx.PhysXSceneQuery, origin: carb._carb.Float3, dir: carb._carb.Float3, distance: float, reportFn: Callable[[omni.physx.bindings._physx.RaycastHit], bool], bothSides: bool = False) bool

Raycast physics scene for all collisions.

Parameters
  • origin – Origin of the raycast.

  • dir – Unit direction of the raycast.

  • distance – Raycast distance.

  • reportFn – Report function where RaycastHits will be reported, return True to continue traversal, False to stop traversal

  • bothSides – Boolean defining whether front and back side of a mesh triangle should be considered for hits.

Returns

Returns true if hit

raycast_any(self: omni.physx.bindings._physx.PhysXSceneQuery, origin: carb._carb.Float3, dir: carb._carb.Float3, distance: float, bothSides: bool = False) bool

Raycast physics scene for any collision, reporting only boolean.

Parameters
  • origin – Origin of the raycast.

  • dir – Unit direction of the raycast.

  • distance – Raycast distance.

  • bothSides – Boolean defining whether front and back side of a mesh triangle should be considered for hits.

Returns

Return a boolean whether raycast hit.

raycast_closest(self: omni.physx.bindings._physx.PhysXSceneQuery, origin: carb._carb.Float3, dir: carb._carb.Float3, distance: float, bothSides: bool = False) dict

Raycast physics scene for the closest collision.

Parameters
  • origin – Origin of the raycast.

  • dir – Unit direction of the raycast.

  • distance – Raycast distance.

  • bothSides – Boolean defining whether front and back side of a mesh triangle should be considered for hits.

Returns

Return a dictionary with raycast hit:

'position': float3 -- Hit position.
'normal': float3 -- Hit normal.
'distance': float -- Hit distance.
'faceIndex': int -- Hit mesh face index.
'collision': string -- Hit collision USD path.
'rigidBody': string -- Hit rigid body USD path.
'protoIndex': int -- Rigid body protoIndex - if not point instancer 0xFFFFFFFF
'material': string -- Hit collider material USD path.

sweep_sphere_all(self: omni.physx.bindings._physx.PhysXSceneQuery, radius: float, origin: carb._carb.Float3, dir: carb._carb.Float3, distance: float, reportFn: Callable[[omni.physx.bindings._physx.SweepHit], bool], bothSides: bool = False) bool

Sphere cast physics scene for all collisions.

Parameters
  • radius – Sphere radius

  • origin – Origin of the sphere cast.

  • dir – Unit direction of the sphere cast.

  • distance – sphere cast distance.

  • reportFn – Report function where SweepHits will be reported, return True to continue traversal, False to stop traversal

  • bothSides – Boolean defining whether front and back side of a mesh triangle should be considered for hits.

Returns

Returns true if hit

sweep_sphere_any(self: omni.physx.bindings._physx.PhysXSceneQuery, radius: float, origin: carb._carb.Float3, dir: carb._carb.Float3, distance: float, bothSides: bool = False) bool

Sphere cast physics scene for any collision, reporting only boolean.

Parameters
  • radius – Sphere radius.

  • origin – Origin of the sphere cast.

  • dir – Unit direction of the sphere cast.

  • distance – Sphere cast distance.

  • bothSides – Boolean defining whether front and back side of a mesh triangle should be considered for hits.

Returns

Return a boolean if sphere sweep hit.

sweep_sphere_closest(self: omni.physx.bindings._physx.PhysXSceneQuery, radius: float, origin: carb._carb.Float3, dir: carb._carb.Float3, distance: float, bothSides: bool = False) dict

Sphere cast physics scene for the closest collision.

Parameters
  • radius – Sphere radius.

  • origin – Origin of the sphere cast.

  • dir – Unit direction of the sphere cast.

  • distance – Sphere cast distance.

  • bothSides – Boolean defining whether front and back side of a mesh triangle should be considered for hits.

Returns

Return a dictionary with raycast hit:

'position': float3 - hit position
'normal': float3 - hit normal
'distance': float - hit distance
'faceIndex': int - hit mesh face index
'collision': string - hit collision USD path
'rigidBody': string - hit rigid body USD path
'protoIndex': int -- Rigid body protoIndex - if not point instancer 0xFFFFFFFF
'material': string -- Hit collider material USD path.

class omni.physx.bindings._physx.PhysXUnitTests

This interface is the access point to omni.physx test support functions.

end_check_for_error(self: omni.physx.bindings._physx.PhysXUnitTests) bool
get_mass_information(self: omni.physx.bindings._physx.PhysXUnitTests, body_path: str) dict

Returns mass information for a given body.

Parameters

body. (body_path - USD path to) –

Returns

Return a dictionary with mass information:

'mass': float - Mass of the body.
'inertia': float3 - Inertia tensor of body.
'com': float3 - Center of mass of the body.

get_materials_paths(self: omni.physx.bindings._physx.PhysXUnitTests, collider_path: str) list

Returns material paths for materials found on given collider path.

Parameters

collider. (collider_path - USD path to a) –

Returns

Return a list of material paths

get_physics_stats(self: omni.physx.bindings._physx.PhysXUnitTests) dict

Returns simulation statistics after a simulation step.

Returns

Return a dictionary with statistics:

'numDynamicRigids': int - Number of dynamic rigids in simulation.
'numStaticRigids': int - Number of static rigids in simulation.
'numKinematicBodies': int - Number of kinematic rigids in simulation.
'numArticulations': int - Number of articulations in simulation.
'numSphereShapes': int - Number of sphere shapes in simulation.
'numBoxShapes': int - Number of box shapes in simulation.
'numCapsuleShapes': int - Number of capsule shapes in simulation.
'numCylinderShapes': int - Number of cylinder shapes in simulation.
'numConvexShapes': int - Number of convex shapes in simulation.
'numTriMeshShapes': int - Number of triangle mesh shapes in simulation.
'numPlaneShapes': int - Number of plane shapes in simulation.
'numConeShapes': int - Number of cone shapes in simulation.

is_cuda_lib_present(self: omni.physx.bindings._physx.PhysXUnitTests) bool
start_check_for_error(self: omni.physx.bindings._physx.PhysXUnitTests, arg0: str) None
update(self: omni.physx.bindings._physx.PhysXUnitTests, elapsedStep: float, currentTime: float) None

Update physics simulation by one step.

Parameters
  • elapsedStep – Simulation step time, time elapsed between last step and this step.

  • currentTime – Current time, might be used for time sampled transformations to apply.

class omni.physx.bindings._physx.PhysXVisualization

This interface is the access point to PhysX SDK debug visualization.

enable_visualization(self: omni.physx.bindings._physx.PhysXVisualization, enable: bool) None

Enable/disable PhysX debug visualization.

Parameters

disable. (enable - Bool if enable or) –

set_visualization_parameter(self: omni.physx.bindings._physx.PhysXVisualization, debug_vis: str, enable: bool) None

Toggle individual debug visualization features.

Parameters
  • identifier (debug_vis - Debug visualization feature string) – {‘WorldAxes’, ‘BodyAxes’, ‘BodyMassAxes’, ‘BodyLinearVel’, ‘BodyAngularVel’, ‘ContactPoint’, ‘ContactNormal’, ‘ContactError’, ‘ContactForce’, ‘ActorAxes’, ‘CollisionAABBs’, ‘CollisionShapes’, ‘CollisionAxes’, ‘CollisionCompounds’, ‘CollisionEdges’, ‘CollisionStaticPruner’, ‘CollisionDynamicPruner’, ‘JointLocalFrames’, ‘JointLimits’, ‘CullBox’, ‘MBPRegions’}

  • following (can be one of the) – {‘WorldAxes’, ‘BodyAxes’, ‘BodyMassAxes’, ‘BodyLinearVel’, ‘BodyAngularVel’, ‘ContactPoint’, ‘ContactNormal’, ‘ContactError’, ‘ContactForce’, ‘ActorAxes’, ‘CollisionAABBs’, ‘CollisionShapes’, ‘CollisionAxes’, ‘CollisionCompounds’, ‘CollisionEdges’, ‘CollisionStaticPruner’, ‘CollisionDynamicPruner’, ‘JointLocalFrames’, ‘JointLimits’, ‘CullBox’, ‘MBPRegions’}

  • feature. (enable - Bool to enable/disable the) –

set_visualization_scale(self: omni.physx.bindings._physx.PhysXVisualization, scale: float) None

Set PhysX debug visualization scale.

Parameters

visualization. (scale - Float value for scaling debug) –

class omni.physx.bindings._physx.PhysicsInteractionEvent

Physics interaction event

Members:

MOUSE_DRAG_BEGAN : Signals that a mouse drag has begun.

MOUSE_DRAG_CHANGED : Signals that the mouse is being dragged.

MOUSE_DRAG_ENDED : Signals that the mouse drag is being released.

MOUSE_LEFT_CLICK : Signals that the mouse left button is clicked.

MOUSE_LEFT_DOUBLE_CLICK : Signals that the mouse left button is being double-clicked.

MOUSE_DRAG_BEGAN = <PhysicsInteractionEvent.MOUSE_DRAG_BEGAN: 0>
MOUSE_DRAG_CHANGED = <PhysicsInteractionEvent.MOUSE_DRAG_CHANGED: 1>
MOUSE_DRAG_ENDED = <PhysicsInteractionEvent.MOUSE_DRAG_ENDED: 2>
MOUSE_LEFT_CLICK = <PhysicsInteractionEvent.MOUSE_LEFT_CLICK: 3>
MOUSE_LEFT_DOUBLE_CLICK = <PhysicsInteractionEvent.MOUSE_LEFT_DOUBLE_CLICK: 4>
property name
property value
class omni.physx.bindings._physx.PhysxPropertyQueryColliderResponse

Collider query response.

property aabb_local_max

AABB Max Local Bound

property aabb_local_min

AABB Min Local Bound

property path_id

USD Path

property result

Result

property stage_id

USD Stage

property volume

Volume of the collider

class omni.physx.bindings._physx.PhysxPropertyQueryMode

Query mode.

Members:

QUERY_RIGID_BODY_WITH_COLLIDERS : Query rigid body and its colliders

QUERY_RIGID_BODY_WITH_COLLIDERS = <PhysxPropertyQueryMode.QUERY_RIGID_BODY_WITH_COLLIDERS: 0>
property name
property value
class omni.physx.bindings._physx.PhysxPropertyQueryResult

Query result enumeration.

Members:

VALID : Result is valid

ERROR_UNKNOWN_QUERY_MODE : The requested query mode is unknown

ERROR_INVALID_USD_PATH : Result invalid because of an invalid USD path

ERROR_INVALID_USD_STAGE : Result invalid because of an invalid or expired USD stage

ERROR_INVALID_USD_PRIM : Result invalid because of an invalid or deleted USD prim

ERROR_PARSING : Result invalid because parsing USD failed

ERROR_TIMEOUT : Result invalid because async operation exceeds timeout

ERROR_INVALID_USD_PATH = <PhysxPropertyQueryResult.ERROR_INVALID_USD_PATH: 2>
ERROR_INVALID_USD_PRIM = <PhysxPropertyQueryResult.ERROR_INVALID_USD_PRIM: 4>
ERROR_INVALID_USD_STAGE = <PhysxPropertyQueryResult.ERROR_INVALID_USD_STAGE: 3>
ERROR_PARSING = <PhysxPropertyQueryResult.ERROR_PARSING: 5>
ERROR_TIMEOUT = <PhysxPropertyQueryResult.ERROR_TIMEOUT: 6>
ERROR_UNKNOWN_QUERY_MODE = <PhysxPropertyQueryResult.ERROR_UNKNOWN_QUERY_MODE: 1>
VALID = <PhysxPropertyQueryResult.VALID: 0>
property name
property value
class omni.physx.bindings._physx.PhysxPropertyQueryRigidBodyResponse

Rigid body query response.

property center_of_mass

Center of Mass

property inertia

Inertia

property mass

Mass

property path_id

USD Path

property principal_axes

Principal Axes Quaternion

property result

Result

property stage_id

USD Stage

property type

Type

class omni.physx.bindings._physx.PhysxPropertyQueryRigidBodyResponseType

Query result.

Members:

RIGID_DYNAMIC : Body is a rigid dynamic

RIGID_DYNAMIC = <PhysxPropertyQueryRigidBodyResponseType.RIGID_DYNAMIC: 0>
property name
property value
class omni.physx.bindings._physx.RaycastHit

Raycast hit results structure.

class omni.physx.bindings._physx.SceneQueryHitLocation

Scene query hit location results structure.

property distance

Hit location distance.

property face_index

Hit location face index.

property material

Path string to the collider material that was hit.

property material_encoded

Encoded SdfPath to the collider material that was hit. PhysicsSchemaTools.decodeSdfPath will return SdfPath.

property normal

Hit location normal.

property position

Hit location position.

class omni.physx.bindings._physx.SceneQueryHitObject

Scene query hit results structure.

property collision

Path string to the collision that was hit.

property collision_encoded

Encoded SdfPath to the collision that was hit. PhysicsSchemaTools.decodeSdfPath will return SdfPath.

property protoIndex

ProtoIndex, filled for pointInstancers otherwise 0xFFFFFFFF.

property rigid_body

Path string to the rigid body that was hit.

property rigid_body_encoded

Encoded SdfPath to the rigid body that was hit. PhysicsSchemaTools.decodeSdfPath will return SdfPath.

class omni.physx.bindings._physx.SimulationEvent

Simulation events used by simulation event stream.

Members:

RESUMED : Simulation resumed, no additional data are send in the event

PAUSED : Simulation paused, no additional data are send in the event

STOPPED : Simulation stopped, no additional data are send in the event

CONTACT_FOUND : Contact found event header: sends header information regarding which colliders started to collide; contains the following in a dictionary:

'actor0':int2 - Usd path to rigid body actor 0 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'actor1':int2 - Usd path to rigid body actor 1 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'collider0':int2 - Usd path to collider 0 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'collider1':int2 - Usd path to collider 1 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'numContactData':int - Num contact data sent after the header is sent.
'stageId':long1 - Current USD stage id, long array with one item.

CONTACT_LOST : Contact lost event header: sends header information regarding which colliders lost contact; contains the following in a dictionary:

'actor0':int2 - Usd path to rigid body actor 0 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'actor1':int2 - Usd path to rigid body actor 1 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'collider0':int2 - Usd path to collider 0 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'collider1':int2 - Usd path to collider 1 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'numContactData':int - Num contact data sent after the header is sent.
'stageId':long1 - Current USD stage id, long array with one item.

CONTACT_PERSISTS : Contact persists event header: sends header information regarding which colliders are still in contact; contains the following in a dictionary:

'actor0':int2 - Usd path to rigid body actor 0 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'actor1':int2 - Usd path to rigid body actor 1 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'collider0':int2 - Usd path to collider 0 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'collider1':int2 - Usd path to collider 1 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'numContactData':int - Num contact data sent after the header is sent.
'stageId':long1 - Current USD stage id, long array with one item.

CONTACT_DATA : Contact data sent after each header contact information is sent; contains the following in a dictionary:

'position':float3 - Contact position
'normal':float3 - Contact normal
'impulse':float3 - Contact impulse
'separation':float - Separation value for collisions.
'faceIndex0':int - USD face index 0.
'faceIndex1':int - USD face index 0.
'material0':int2 - Usd path to material 0 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.
'material1':int2 - Usd path to material 0 decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.

JOINT_BREAK : Joint break event; contains the following in a dictionary:

'jointPath':int2 - Usd path to joint that did break decoded into two ints. PhysicsSchemaTools.decodeSdfPath will return SdfPath.

POINT_GRABBED : Point grabbed; contains the following in a dictionary:

'grabbed_position':float3 - Current world position of grabbed point.
'grab_force_position':float3 - Current world position of the position being grabbed towards.

POINT_RELEASED : Point released.

POINT_PUSHED : Point pushed; contains the following in a dictionary:

'pushed_position':float3 - World position of point pushed.

ATTACHED_TO_STAGE : When physx stage attachment (initialization) finished.

DETACHED_FROM_STAGE : When physx stage detachment (deinitialization) finished.

ATTACHED_TO_STAGE = <SimulationEvent.ATTACHED_TO_STAGE: 10>
CONTACT_DATA = <SimulationEvent.CONTACT_DATA: 6>
CONTACT_FOUND = <SimulationEvent.CONTACT_FOUND: 3>
CONTACT_LOST = <SimulationEvent.CONTACT_LOST: 4>
CONTACT_PERSISTS = <SimulationEvent.CONTACT_PERSISTS: 5>
DETACHED_FROM_STAGE = <SimulationEvent.DETACHED_FROM_STAGE: 11>
JOINT_BREAK = <SimulationEvent.JOINT_BREAK: 7>
PAUSED = <SimulationEvent.PAUSED: 1>
POINT_GRABBED = <SimulationEvent.POINT_GRABBED: 8>
POINT_PUSHED = <SimulationEvent.POINT_PUSHED: 12>
POINT_RELEASED = <SimulationEvent.POINT_RELEASED: 9>
RESUMED = <SimulationEvent.RESUMED: 0>
STOPPED = <SimulationEvent.STOPPED: 2>
property name
property value
class omni.physx.bindings._physx.SweepHit

Sweep hit results structure.

class omni.physx.bindings._physx.TriggerEventData

Parameters for trigger event callback.

property event_type

Event Type (enter or leave)

property other_body_prim_id

USD Path of the body containgint the other collider prim entering trigger

property other_collider_prim_id

USD Path of other prim entering trigger

property stage_id

USD Stage

property subscription_id

Id of the subscription returned by subscribe_physics_trigger_report_events

property trigger_body_prim_id

USD Path of the body containg the collider prim representing the trigger

property trigger_collider_prim_id

USD Path of prim representing the trigger

class omni.physx.bindings._physx.TriggerEventType

Trigger Event type.

Members:

TRIGGER_ON_ENTER : The collider has entered trigger volume

TRIGGER_ON_LEAVE : The collider has left trigger volume

TRIGGER_ON_ENTER = <TriggerEventType.TRIGGER_ON_ENTER: 0>
TRIGGER_ON_LEAVE = <TriggerEventType.TRIGGER_ON_LEAVE: 1>
property name
property value
class omni.physx.bindings._physx.VisualizerMode

Visualization mode for collider, particles, deformables, etc. object types.

ALL = 2
NONE = 0
SELECTED = 1
omni.physx.bindings._physx.acquire_physx_attachment_interface(plugin_name: str = None, library_path: str = None) omni.physx.bindings._physx.IPhysxAttachment
omni.physx.bindings._physx.acquire_physx_benchmarks_interface(plugin_name: str = None, library_path: str = None) omni.physx.bindings._physx.IPhysxBenchmarks
omni.physx.bindings._physx.acquire_physx_cooking_interface(plugin_name: str = None, library_path: str = None) omni.physx.bindings._physx.PhysXCooking
omni.physx.bindings._physx.acquire_physx_interface(plugin_name: str = None, library_path: str = None) omni.physx.bindings._physx.PhysX
omni.physx.bindings._physx.acquire_physx_property_query_interface(plugin_name: str = None, library_path: str = None) omni.physx.bindings._physx.IPhysxPropertyQuery
omni.physx.bindings._physx.acquire_physx_replicator_interface(plugin_name: str = None, library_path: str = None) omni.physx.bindings._physx.IPhysxReplicator
omni.physx.bindings._physx.acquire_physx_scene_query_interface(plugin_name: str = None, library_path: str = None) omni.physx.bindings._physx.PhysXSceneQuery
omni.physx.bindings._physx.acquire_physx_simulation_interface(plugin_name: str = None, library_path: str = None) omni.physx.bindings._physx.IPhysxSimulation
omni.physx.bindings._physx.acquire_physx_visualization_interface(plugin_name: str = None, library_path: str = None) omni.physx.bindings._physx.PhysXVisualization
omni.physx.bindings._physx.acquire_physxunittests_interface(plugin_name: str = None, library_path: str = None) omni.physx.bindings._physx.PhysXUnitTests
omni.physx.bindings._physx.ancestorHasAPI(arg0: TfType, arg1: UsdPrim) bool
omni.physx.bindings._physx.descendantHasAPI(arg0: TfType, arg1: UsdPrim) bool
omni.physx.bindings._physx.hasconflictingapis_ArticulationRoot(arg0: UsdPrim, arg1: bool) bool
omni.physx.bindings._physx.hasconflictingapis_CollisionAPI(arg0: UsdPrim, arg1: bool) bool
omni.physx.bindings._physx.hasconflictingapis_PhysxDeformableBodyAPI(arg0: UsdPrim, arg1: bool) bool
omni.physx.bindings._physx.hasconflictingapis_PhysxDeformableSurfaceAPI(arg0: UsdPrim, arg1: bool) bool
omni.physx.bindings._physx.hasconflictingapis_PhysxParticleClothAPI(arg0: UsdPrim, arg1: bool) bool
omni.physx.bindings._physx.hasconflictingapis_PhysxParticleSamplingAPI(arg0: UsdPrim, arg1: bool) bool
omni.physx.bindings._physx.hasconflictingapis_Precompute(arg0: UsdPrim) List[bool[3]]
omni.physx.bindings._physx.hasconflictingapis_RigidBodyAPI(arg0: UsdPrim, arg1: bool) bool
omni.physx.bindings._physx.isOverConflictingApisSubtreeLimit(arg0: UsdPrim, arg1: int) bool
omni.physx.bindings._physx.release_physx_attachment_interface(arg0: omni.physx.bindings._physx.IPhysxAttachment) None
omni.physx.bindings._physx.release_physx_benchmarks_interface(arg0: omni.physx.bindings._physx.IPhysxBenchmarks) None
omni.physx.bindings._physx.release_physx_cooking_interface(arg0: omni.physx.bindings._physx.PhysXCooking) None
omni.physx.bindings._physx.release_physx_interface(arg0: omni.physx.bindings._physx.PhysX) None
omni.physx.bindings._physx.release_physx_interface_scripting(arg0: omni.physx.bindings._physx.PhysX) None
omni.physx.bindings._physx.release_physx_property_query_interface(arg0: omni.physx.bindings._physx.IPhysxPropertyQuery) None
omni.physx.bindings._physx.release_physx_replicator_interface(arg0: omni.physx.bindings._physx.IPhysxReplicator) None
omni.physx.bindings._physx.release_physx_replicator_interface_scripting(arg0: omni.physx.bindings._physx.IPhysxReplicator) None
omni.physx.bindings._physx.release_physx_scene_query_interface(arg0: omni.physx.bindings._physx.PhysXSceneQuery) None
omni.physx.bindings._physx.release_physx_simulation_interface(arg0: omni.physx.bindings._physx.IPhysxSimulation) None
omni.physx.bindings._physx.release_physx_visualization_interface(arg0: omni.physx.bindings._physx.PhysXVisualization) None
omni.physx.bindings._physx.release_physxunittests_interface(arg0: omni.physx.bindings._physx.PhysXUnitTests) None