usdPhysics: add UsdPhysicsRigidBodyAPI::GetCollisionPrims - #7
Closed
andrewkaufman wants to merge 2 commits into
Closed
andrewkaufman wants to merge 2 commits into
andrewkaufman wants to merge 2 commits into
Conversation
UsdPhysicsRigidBodyAPI::ComputeMassProperties gathered every descendant prim with PhysicsCollisionAPI applied, regardless of whether the collider was enabled. A collider with physics:collisionEnabled = false was still contributing its mass, center of mass, and inertia to the body. physics:collisionEnabled determines whether the PhysicsCollisionAPI is enabled; a collider whose collision is disabled takes no part in simulation and so should not contribute to a body's aggregated mass properties. Skip colliders whose resolved physics:collisionEnabled is false when gathering shapes for the mass computer. Also clarifies in the PhysicsMassAPI documentation and the usdPhysics overview that a disabled collider or disabled rigid body takes no part in simulation, so it is excluded from mass computation and any MassAPI applied to it has no effect. Adds a regression test: a rigid body with one enabled unit cube and one disabled cube offset along z now reports the mass, center of mass, and inertia of the single enabled cube only.
andrewkaufman
commented
Jul 22, 2026
andrewkaufman
commented
Jul 22, 2026
Exposes the traversal that ComputeMassProperties uses to gather the colliders belonging to a rigid body as a public method. Starting at the body prim, the subtree is traversed (including instance proxies) and every enabled UsdPhysicsCollisionAPI prim is collected; subtrees rooted at nested rigid bodies are pruned since those colliders belong to a different body, and colliders whose physics:collisionEnabled is false are skipped. ComputeMassProperties is refactored to call GetCollisionPrims so the body-ownership and enabled-collider semantics live in one place, and clients (e.g. physics engines consuming USD) can reproduce them without re-implementing the traversal. Adds a Python wrapping returning the list of collider prims and a regression test covering the enabled/disabled/nested-body cases.
andrewkaufman
force-pushed
the
add-collision-prims-api
branch
from
July 22, 2026 23:15
9216f81 to
7e7a9ff
Compare
Owner
Author
|
Superseded by upstream PR PixarAnimationStudios#4165 (squashed, on top of PixarAnimationStudios#4164). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change(s)
Adds a public method
UsdPhysicsRigidBodyAPI::GetCollisionPrims()that returns the collider prims belonging to a rigid body — the same traversalComputeMassProperties()uses internally to decide which colliders' mass is accumulated into the body.Starting at the rigid body's prim, the subtree is traversed (including instance proxies) and every prim with
UsdPhysicsCollisionAPIapplied is collected, with two exceptions:physics:collisionEnabledresolves tofalseis skipped, since a disabled collider takes no part in simulation; andUsdPhysicsRigidBodyAPIis pruned, since those colliders belong to that other rigid body rather than to this one.ComputeMassProperties()is refactored to callGetCollisionPrims(), so the body-ownership and enabled-collider semantics live in exactly one place.Motivation: downstream physics engines consuming USD currently have to re-implement this exact traversal (subtree ownership + nested-body pruning + enabled-collider filtering) to determine which colliders belong to a body. Exposing it as a public method lets them reuse the canonical logic instead of duplicating it.
Includes a Python wrapping (returns a list of collider prims) and a regression test covering the enabled / disabled / nested-body-pruned cases.
Dependency
This stacks on top of the disabled-collider mass fix (PixarAnimationStudios#4164). Draft until that lands; the enabled-collider filter in
GetCollisionPrims()shares that behavior.Link to proposal
N/A — additive public API, no schema change.
Checklist