Skip to content

Commit fd8d9d4

Browse files
authored
Fix particle collisions for disabled USD colliders (#3785)
1 parent 003c520 commit fd8d9d4

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
- Fix panel-parallel RCM-blocked LLT factorization hanging when a matrix ends in a partial tile.
106106
- Fix USD capsule, cylinder, and cone visual and site scaling to follow the authored primitive axis.
107107
- Fix MJCF contact pairs ignoring properties inherited from pair default classes.
108+
- Fix disabled USD colliders participating in particle collisions when visual shape loading is disabled.
108109
- Fix `ArticulationView.is_fixed_base` for roots with zero effective degrees of freedom, including fully locked D6 joints. (#3727)
109110
- Fix USD plane visual width and length to scale along the axes defined by the `UsdGeomPlane` schema, and orient X- and Y-axis plane visuals along the authored axis.
110111
- Validate `ArticulationView` mask shapes and devices before launching selection kernels. (#3448)

newton/_src/utils/import_usd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3928,7 +3928,7 @@ def _record_fallback_collider_mass_information(
39283928

39293929
if not collider_is_enabled:
39303930
no_collision_shapes.add(shape_id)
3931-
builder.shape_flags[shape_id] &= ~ShapeFlags.COLLIDE_SHAPES
3931+
builder.shape_flags[shape_id] &= ~(ShapeFlags.COLLIDE_SHAPES | ShapeFlags.COLLIDE_PARTICLES)
39323932

39333933
# Approximate meshes. ``physics:approximation`` belongs to
39343934
# UsdPhysicsMeshCollisionAPI and is scoped to collision: it says which shape to

newton/tests/test_import_usd.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5257,8 +5257,8 @@ def test_static_gaussian_respects_loading_flag(self):
52575257
self.assertNotIn(gaussian.GetPath().pathString, result_no_visuals["path_shape_map"])
52585258

52595259
@unittest.skipUnless(USD_AVAILABLE, "Requires usd-core")
5260-
def test_disabled_static_collider_loads_as_visual(self):
5261-
"""Load disabled static colliders as visual-only shapes."""
5260+
def test_disabled_static_collider_has_no_collision_flags(self):
5261+
"""Disable shape and particle collisions regardless of visual loading."""
52625262
from pxr import Usd, UsdGeom, UsdPhysics
52635263

52645264
stage = Usd.Stage.CreateInMemory()
@@ -5271,8 +5271,15 @@ def test_disabled_static_collider_loads_as_visual(self):
52715271
flags = builder.shape_flags[result["path_shape_map"][collider.GetPath().pathString]]
52725272

52735273
self.assertFalse(flags & ShapeFlags.COLLIDE_SHAPES)
5274+
self.assertFalse(flags & ShapeFlags.COLLIDE_PARTICLES)
52745275
self.assertFalse(flags & ShapeFlags.VISIBLE)
52755276

5277+
headless_builder = newton.ModelBuilder()
5278+
headless_result = headless_builder.add_usd(stage, load_visual_shapes=False)
5279+
headless_flags = headless_builder.shape_flags[headless_result["path_shape_map"][collider.GetPath().pathString]]
5280+
self.assertFalse(headless_flags & ShapeFlags.COLLIDE_SHAPES)
5281+
self.assertFalse(headless_flags & ShapeFlags.COLLIDE_PARTICLES)
5282+
52765283
@unittest.skipUnless(USD_AVAILABLE, "Requires usd-core")
52775284
def test_granular_loading_flags(self):
52785285
"""Test the granular control over sites and visual shapes loading."""

0 commit comments

Comments
 (0)