Joints#
A joint connects two bodies and limits how they move relative to each other, like the hinge of a door.

Joint Types#
Each type is its own prim type in USD:
Type |
Prim Type |
The Second Body Can |
Example |
|---|---|---|---|
Fixed |
|
Not move relative to the first. |
Two parts welded together. |
Revolute |
|
Turn around one axis. |
A door hinge or a wheel. |
Prismatic |
|
Slide along one axis. |
A drawer. |
Spherical |
|
Turn in any direction around one point. |
A shoulder. |
Distance |
|
Move freely within a minimum and maximum distance. |
A rope. |
D6 (six degrees of freedom) |
|
Slide along and turn around each of three axes, each free, limited, or locked. |
Anything the other types cannot do. |
Connecting Two Bodies#
A joint prim names its bodies with the relationships physics:body0 and physics:body1. Leave
one out to attach the other body to the world.
The joint holds a point of one body to a point of the other. You give each point, with its axes, as a joint frame:
Attribute |
Meaning |
|---|---|
|
Position and rotation of the joint frame on body 0, in body 0’s own coordinates. When body 0 is the world, they are in world coordinates. |
|
The same for body 1. |
|
The frame axis, |
Place the bodies so that the two frames meet at the start. If they do not, ovphysx logs a warning and snaps the bodies into place in the first step.
The two bodies of a joint do not collide with each other. To let them collide, set the joint’s
own physics:collisionEnabled to true.
Limits#
A limit stops a joint at a minimum or a maximum, like a door stop.
Joint |
Limit Attributes |
Unit |
|---|---|---|
Revolute |
|
Degrees |
Prismatic |
|
Distance |
Spherical |
|
Degrees |
Distance |
|
Distance |
D6 |
One |
Degrees or distance |
Drives#
A drive is a motor on a joint. It pushes the joint toward a target position, a target velocity, or both, like a spring with a damper:
force = stiffness × (target position − position)
+ damping × (target velocity − velocity)
On a revolute joint, apply PhysicsDriveAPI:angular and set these attributes:
Attribute |
Meaning |
|---|---|
|
The angle the drive pulls toward, in degrees. |
|
The speed the drive pushes toward, in degrees per second. |
|
How strongly the drive pulls toward the target angle, as torque per degree. |
|
How strongly the drive resists any speed other than the target velocity. |
A prismatic joint takes PhysicsDriveAPI:linear with the same attributes, in distances. A drive
that keeps a speed, such as a spinning wheel, sets the stiffness to 0 and uses damping with a
target velocity.
The following program, joints_drive.py, turns an arm on a hinge to 90 degrees:
The imports and the scene, in USD
import math
import ovstage
from ovphysx.population import physics_population_descs
from ovphysx import PhysX
from ovphysx.samples.python_samples.schema_support import physx_schema_paths
from ovphysx.types import SimObjectType
# A 1 m arm that lies along the x axis. A hinge at the origin lets it turn
# around the vertical z axis, and a drive turns it to 90 degrees.
SCENE = """#usda 1.0
(
metersPerUnit = 1
kilogramsPerUnit = 1
upAxis = "Z"
)
def Xform "World"
{
def PhysicsScene "PhysicsScene" {}
def Capsule "Arm" (
prepend apiSchemas = ["PhysicsRigidBodyAPI", "PhysicsCollisionAPI"]
)
{
double radius = 0.05
double height = 0.9
uniform token axis = "X"
double3 xformOp:translate = (0.5, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
def PhysicsRevoluteJoint "Hinge" (
prepend apiSchemas = ["PhysicsDriveAPI:angular"]
)
{
rel physics:body1 = </World/Arm>
uniform token physics:axis = "Z"
point3f physics:localPos0 = (0, 0, 0)
point3f physics:localPos1 = (-0.5, 0, 0)
float drive:angular:physics:targetPosition = 90
float drive:angular:physics:stiffness = 2
float drive:angular:physics:damping = 0.6
}
}
"""
def arm_angle(physx):
"""Read the arm's center and return its angle around the hinge in degrees."""
with physx.read_sync(SimObjectType.RIGID_BODY, ["position"]) as result:
x, y, _ = result.groups[0].tensors[0].numpy()[0]
return math.degrees(math.atan2(y, x))
ovstage.population.register_usd_schemas([str(p) for p in physx_schema_paths()])
stage = ovstage.Stage("driven_arm")
ovstage.population.open_usd_from_string_with_desc(
stage, SCENE, ordinal=1, time=ovstage.population.DEFAULT_TIME, descs=physics_population_descs(rendering=True)
)
stage.advance_write_floor(ordinal=1).wait()
physx = PhysX()
physx.wait_task(physx.attach_ovstage(stage, read_ordinal=1))
print(f"t=0.00 s angle = {arm_angle(physx):3.0f} deg")
for step in range(1, 97):
physx.step_sync(1.0 / 60.0)
if step % 12 == 0:
print(f"t={step / 60:.2f} s angle = {arm_angle(physx):3.0f} deg")
physx.wait_task(physx.detach_ovstage())
physx.destroy()
stage.destroy()
It prints:
t=0.00 s angle = 0 deg
t=0.20 s angle = 32 deg
t=0.40 s angle = 64 deg
t=0.60 s angle = 80 deg
t=0.80 s angle = 87 deg
t=1.00 s angle = 89 deg
t=1.20 s angle = 90 deg
t=1.40 s angle = 90 deg
t=1.60 s angle = 90 deg
Notice the following:
ovphysx reads joint angles only for the joints of an articulation, which Articulations introduces. The program computes the angle from the arm’s position instead.
The following figure shows the same arm with less and with more damping:

A drive acts like a spring, so a steady load, such as the weight of an arm held out sideways, holds the joint short of its target. A higher stiffness makes the gap smaller.
To change a drive target while the simulation runs, edit the joint in the stage, as Changing the Scene shows.
Turning a Joint Off#
To leave a joint out of the simulation, set physics:jointEnabled = false on the joint prim.
Its bodies then move freely.
More Detail#
Joints (reference) covers soft limits, breaking joints, gear joints, and joint instancing.
Articulations (reference) covers the joints of articulations.
DirectGPU mode, described in Data on the GPU, rejects distance joints.
PhysicsJoint, PhysicsRevoluteJoint, PhysicsPrismaticJoint, PhysicsSphericalJoint, PhysicsDistanceJoint, PhysicsFixedJoint, PhysicsDriveAPI, and PhysicsLimitAPI list every setting.
Next: Articulations builds a robot arm from joints and drives.