Physics

Introduction

NVIDIA Omniverse™ Create features real time physics simulation. Create relies on the NVIDIA PhysX SDK for rigid body dynamics, NVIDIA Blast for destruction and fracture, and NVIDIA Flow for fluid dynamics.

Note

The Physics integration still has the following known issues:

  • Only a single simulation scene is supported.

  • Pair and Group filtering cannot be changed during simulation.

  • Debug visualization can be very slow for large scenes.

Rigid Body Dynamics

Getting Started

To start using physics simulation, the appropriate extensions must be enabled. Currently the following extensions are available:

Extension

Description

omni.physx.core

Basic functionality

omni.kit.property.bundle

Editor Property Window

omni.physx.cct

Character controller

Make sure that you have enabled these extensions in the Window->Extensions window.

Adding Basic Physics to Your Scene

As a first step, making sure the units of your scene are set up correctly is very important, because it will influence the behavior of your simulation. These units (Meters Per Unit, Kilograms Per Unit, and Time Codes Per Second) are visible as metadata properties of your root layer.

Before you can have anything that behaves physically in your scene, you need to add a PhysicsScene. This object holds basic physics settings like gravity. All physical objects have to be tied to a scene. To create a scene, select Physics > Create > Physics Scene.

Often it makes sense to create these physics objects in their own layer.

Select the PhysicsScene in the stage window; the Property window will now let you change important simulation settings such as gravity. As long as you only have a single PhysicsScene in your scene, it will act as the default, and all physics object will automatically be associated with it.

The next most important thing you will generally need in your scene are static colliders. These are objects that don’t move (unless you move them) but will still collide with physical objects, such as the walls or floor of a room. The simplest case is a so called ground plane, which can be created via Physics > Create > Ground Plane. This will add a new object comprised of a big quad visual and a static Plane collider. This will prevent your dynamic objects from falling indefinitely.

If you have your own mesh or prim geometry that you would like to make into a collider, just select it and then click Physics > Set > Collider. Instead of creating a new USD object, this will simply add physics collision attributes to the existing object. The precise set of attributes added may depend on the kind of object you have selected.

Finally, to make something into a dynamic rigid body, select it, and then click Physics > Set > Rigid Body. In addition to adding colliders, this will also add rigid body attributes. Note that when you select an entire subtree of objects, collision attributes will be added to every applicable geometry, while the rigid body attributes are only added to the topmost node in the selection. This means that all parts of your selection will collide with the world, and everything parented under the topmost node will move together with it as a rigid assembly. Notice that additional physics attributes have been added to the Property window.

An object can only be made to move as a single unit. If you have multiple things combined together into a single mesh object, you will need to separate them into parts first, before physics can make them move independently.

Once you have a dynamic object defined, you can press the Play button. If you did everything right, this will make the object start falling until it hits your static object or ground plane, and comes to rest. Pressing Stop will (by default) reset your simulation state to how it was before you pressed Play. While the simulation is running, you can also pull the dynamic object(s) around by shift-clicking and dragging them. They should try to follow your mouse cursor but still collide with obstacles.

Note

  • The Physics > Create menu creates new prims in your stage.

  • The Physics > Set menu adds physics properties to your selection.

  • The Physics > Remove menu removes properties from your selection.

  • The Physics > Collision Mesh Approximation and Physics > Joint Attributes menus set preferences for the next collision creation or Physics > Create > Joint operation respectively. They do not modify the currently selected prim.

Physics Properties

All physics properties of an object are visible in the Window > Property window.

In the Property window there is a Physics Components rollout with an Add Component dropdown. The contents of this dropdown are context sensitive and show the physics components that can be added to the selected object. Adding such a component will populate the Property window with new rollouts and attributes.

A Remove Prim Component dropdown is also available on prims with at least one physics component. You use this to remove physical attributes from an object again.

Rigid bodies and colliders have a Rigid Body Enabled and Collision Enabled, respectively. This check box that can be used to temporarily disable rigid body and collision behavior respectively without entirely removing the respective component and losing all the attribute settings.

The kinematic Enabled check box is for making animated key frame objects that can ‘push’ dynamic physics objects. First you need to key frame animate the object (see the Animation section of this guide), then just tick that check box and it should just work.

Note that many attribute edit fields in the Property window have a right click pop-up menu that lets them be reset to a default, minimum or maximum value.

Mass Properties

By default, the mass of a dynamic body is derived from the total volume of all the collision geometry under the body, multiplied by a density. Unless a density is specified explicitly, a default of 1000 will be used. One can set an explicit density on any collider by adding a Mass component. In a hierarchy, a child’s prim’s density overrides parent prim’s density. However, a parent’s explicit Mass will override a child’s density derived mass. It is also possible to have a density set in a PhysicsMaterial, which has the weakest precedence. Physics materials will be discussed later.

Collision Shape Settings

Implicit shape prims are automatically converted to a matching physics representation and don’t need further configuration. Most of their settings are relatively obscure and can be left at their default values. The Collision Offset tuning parameter is perhaps worth mentioning, it defines a small distance from the surface of the object at which contacts will start being generated.

Prims of type Mesh get an additional Mesh Collision rollout: This controls if the mesh should receive very coarse collision in the form of a box or sphere, a fitted convex hull, or even a decomposition into convex pieces. Note that PhysX doesn’t currently support collision between two dynamic triangle meshes.

Generally, the generated collision shapes are not exactly the same as render geometry, so it can be important to see them. The viewport has an Eye icon menu containing Show By Type > Physics Mesh. This will render collision shapes with an outline based on the USD state.

Note

  • Physics treats meshes as single sided for collision purposes, while Omniverse renders all meshes as double sided by default. This creates a tension that makes it easy to author scenes that don’t behave as intended. We recommend that in the Rendering > Render Settings window, under the Common tab, users authoring physics colliders enable Back Face Culling so it becomes clear which faces are front vs back facing.

  • If a mesh has faces facing the wrong way, this can be inverted using the Geometry > Orientation dropdown in the Property window of the mesh.

  • Currently collision visualization does not effectively distinguish front and back faces of triangles, we hope to improve this in the future.

Physics Materials

Physics materials can be created via Physics > Create > PhysicsMaterial. This will create a material object that can be assigned to colliders using the dropdown in the Physics Materials on Selected Objects rollout. Alternatively, one can use the Add Component dropdown in the Physics Components rollout of an existing graphics material to extend it with physics properties. It can then be assigned as a Physics Material using the above method.

Physics materials have friction, restitution (a.k.a. ‘bouncyness’) and material density attributes.

Collision Groups

Collision groups are groups that colliders can belong to. Once you have multiple collision groups, you can set them up to collide with each other or not. You can create a collision group object using Physics > Create > Collision Group. One adds collision shapes to the group using the Includes and Excludes attributes, subject to inheritance rules defined by Expansion Rule (see https://graphics.pixar.com/usd/docs/api/class_usd_collection_a_p_i.html#details for details).

All objects in the same collision group will collide with each other. By default, objects in two different collision groups will also collide. In the Property window of one collision group, however, you can add a list of other collision groups this group should not collide with. PhysicsScene has an attribute Invert Collision Group Filter that lets you invert this behavior, in case you prefer that by default different groups should not collide, and then specify pairs of collision groups that do collide.

Pairwise Collision Filter

In cases where using collision groups is insufficiently fine grained, one may select two bodies, colliders or articulations, and choose Physics > Set > Pair Collision Filter. This will disable collision between only the pair of selected objects which will both have a Filtered Pairs rollout added. This takes precedence over collision groups.

Joints

Joints give you the ability to connect rigid bodies in ways that are not entirely rigid. A good example is a car: the wheels of the car revolve around their respective axes, the suspension can slide up and down along an axis. The technical terms for the former is “revolute joint”, the second is a “prismatic joint”.

To add a joint to your scene, first select the two objects to connect. It is also possible to select a single joint in order to connect it to the world frame. Then select Physics > Create > Joint. In a submenu you will be able to select the type of joint.

When the joint is selected, its joint gizmo will be drawn. This is the usual coordinate frame in the 3d view, along with some joint type specific visualization to indicate the joint’s field of motion. The joint can be translated or rotated using this gizmo as if it was any other kind of 3d object.

The properties pane of the newly created joint will show its properties, including:

Attribute

Description

Joint Enabled

Can be used to disable the joint temporarily.

Axis

For some joint types, selects the axis along which the joint rotates or slides.

Break Force, Torque

If the joint experiences more strain than this value during simulation, it will disconnect.

Note also that each joint is defined by two attachment frames, Local Position/Rotation 0 and 1. Each is defined relative to the respective object being connected. (So a Local Position 0 of (0,0,0) means the joint attaches at the origin of Body 0.) Normally these two local frames line up in world space, and define the ‘global’ position of the joint gizmo. It is however possible that the frames do not line up. In this case the global pose of the joint gizmo will be either one of the two joint frames, or a pose in between the two, depending on the specific behavior of the joint type.

You can use the dropdown Add Component to add drives or limits to your joint. Limits let you reduce the permissible range of motion, and drives let you add spring and damper elements or a motor.

Articulations

Articulations are an advanced, hierarchic mode of joints, useful for creating hierarchical mechanisms such as a vehicle or a robot. To use articulations, one should organize the joints of a mechanism and the objects they connect into a tree structure. For example, to create an articulated wheelbarrow, one would create the body (tray) object, which would have a child revolute joint for the wheel axis, and the joint would have a child wheel body. To mark the wheelbarrow as an articulation, an Articulation Root component must be added to its top level body.

The graph of joints connecting bodies will be parsed starting at this body, and the parts will be simulated relative to one another, which is more accurate than conventional jointed simulation. Joints in the hierarchy that close loops will be ignored by the articulation and be simulated in the conventional manner. Joints have an Exclude from Articulation attribute which can be used to select one of multiple potential loop closure joints to be ignored. Note that the Articulation Root has an Enable Self Collisions attribute. If this is cleared, it automatically filters all collisions between parts of the hierarchy.

Character Controller

A character controller (CCT) is our name for a video game style movement controller that permits the player to move around a world without being able to go through walls. To use this feature, be sure that the omni.physx.cct extension is loaded.

The player is represented by a capsule shape, so start by creating a capsule primitive (Create > Shape > Capsule). Then pull up the CCT window Physics > Character Controller, and press the Activate CCT button while the Capsule is selected. This will hide the capsule and give it CCT properties. When the Play button is pressed, you will take control of the CCT and can see a “first person” view. The CCT should collide with physical objects as expected.

Physics Settings

The Physics > Settings window has some important opportunities to configure your simulation. The Update to USD and Reset Simulation On Stop control what exactly should happen when you press Play. Depending on the settings, the simulation results will either be written back to USD just like editing operations, or just rendered with no side effect. Reset on stop means Create reverts state that the simulator has changed when Stop is pressed to just how it was when Play was pressed.

Use Fast Cache is an internal performance optimization that avoids updating some internal data structures. If you run into any consistency issues it is a good idea to try again with this turned off.

Under the Simulator rollout you will find basic settings like how many times the simulation should update per second. More steps per second generally means more robust physics. This can be further improved with more substeps at the cost of higher computational load. Smaller time steps are usually more beneficial than more substeps: Stacking stability will benefit from more substeps, but collision detection will only become more robust with smaller time steps.

The number of simulation threads controls how many background threads are spawned and reserved for simulation.

Some important simulation settings are not global but rather per-scene, and can be found in the Properties window of the Scene. Enable GPU Dynamics in particular is important, and should be used to check discrepancies in results between CPU and GPU simulation modes.

Physics Debug

The Physics > Debug window should be the first place to look when physics simulation is generating unexpected results. One of the most important diagnostics is right at the top: Step lets you advance your simulation one time step at a time, so you can closely observe problems that happen very quickly.

There is a low level visualizer in the Physics Debug window Simulator Debug Visualization rollout that renders directly based on the PhysX engine’s state, which is useful if for some reason it is not in sync with USD. This needs to be enabled with the Enabled check box, and then individual visualization options can be selected from the list below. The Scale field can be used to adjust the length of some lines and arrows. It is important to note that this data is only generated in Play mode when the simulator is running.

Also, some data like contact points are generated at the start of an update, and bodies are moved at the end of the update. Shapes are also drawn using their state at the start of an update so they line up with contact points. For this reason the visualization display will look one frame behind the graphics rendering.