@@ -13197,9 +13197,7 @@ def _to_wp_array(data, dtype, requires_grad):
1319713197 m.mujoco.equality_constraint_world_start = wp.array(self._equality_constraint_world_start, dtype=wp.int32)
1319813198 m.constraint_mimic_count = len(self.constraint_mimic_joint0)
1319913199
13200- # The packed array was just installed on the model, so builder and
13201- # model filters are known to match without rebuilding it.
13202- self._find_shape_contact_pairs(m, allow_filter_blocks=True)
13200+ self._find_shape_contact_pairs(m)
1320313201
1320413202 # enable ground plane
1320513203 m.up_axis = self.up_axis
@@ -13511,43 +13509,7 @@ def _validate_compact_shape_collision_filter_blocks(self, compact_filter_blocks)
1351113509 )
1351213510 validated_templates.add(template_key)
1351313511
13514- def find_shape_contact_pairs(self, model: Model):
13515- """Deprecated method for rebuilding explicit shape contact pairs.
13516-
13517- .. deprecated:: 1.4
13518- Shape contact pairs are generated automatically by :meth:`finalize`.
13519- Configure collision filters before finalization instead of rebuilding
13520- contact pairs manually.
13521-
13522- Identifies and stores all potential shape contact pairs for collision detection.
13523-
13524- This method examines the collision groups and collision masks of all shapes in the model
13525- to determine which pairs of shapes should be considered for contact generation. It respects
13526- any user-specified collision filter pairs to avoid redundant or undesired contacts.
13527-
13528- The resulting contact pairs are stored in the model as a 2D array of shape indices.
13529-
13530- Uses the exact same filtering logic as the broad phase kernels (test_world_and_group_pair)
13531- to ensure consistency between EXPLICIT mode (precomputed pairs) and NXN/SAP modes.
13532-
13533- Args:
13534- model: The simulation model to which the contact pairs will be assigned.
13535-
13536- Side Effects:
13537- - Sets `model.shape_contact_pairs` to a wp.array of shape pairs (wp.vec2i).
13538- - Sets `model.shape_contact_pair_count` to the number of contact pairs found.
13539- """
13540- warnings.warn(
13541- "ModelBuilder.find_shape_contact_pairs() is deprecated; shape contact pairs are generated "
13542- + "automatically by ModelBuilder.finalize(). Configure collision filters before finalization instead.",
13543- DeprecationWarning,
13544- stacklevel=2,
13545- )
13546- # Deprecated calls may supply an unrelated model or a builder that has
13547- # changed since finalization, so always query filters from the model.
13548- self._find_shape_contact_pairs(model, allow_filter_blocks=False)
13549-
13550- def _find_shape_contact_pairs(self, model: Model, *, allow_filter_blocks: bool) -> None:
13512+ def _find_shape_contact_pairs(self, model: Model) -> None:
1355113513 filter_pairs = self._shape_collision_filter_pairs
1355213514 world_filter_blocks: tuple[_ShapeCollisionFilterBlock, ...] = ()
1355313515 explicit_filter_pairs: tuple[tuple[int, int], ...] = ()
@@ -13570,11 +13532,7 @@ def _find_shape_contact_pairs(self, model: Model, *, allow_filter_blocks: bool)
1357013532 self._iter_validated_shape_collision_filter_pairs((*filter_pairs.explicit_pairs, *floating_block_pairs))
1357113533 )
1357213534
13573- # Builder-side storage is valid only while it describes the model's
13574- # filters exactly; otherwise the general path queries the model.
13575- use_world_templates = (
13576- allow_filter_blocks and self.world_count > 0 and isinstance(filter_pairs, _BuilderShapeCollisionFilterPairs)
13577- )
13535+ use_world_templates = self.world_count > 0 and isinstance(filter_pairs, _BuilderShapeCollisionFilterPairs)
1357813536 if use_world_templates:
1357913537 shape_world_np = np.asarray(self.shape_world, dtype=np.int32)
1358013538 starts = self.shape_world_start
0 commit comments