Skip to content

novaphy.CollisionPipeline

Newton-style explicit collision pipeline handle. A thin per-model descriptor that selects the broadphase backend and produces matching Contacts aggregates. Solvers consume contacts but do not run broadphase or narrowphase internally, so most simulation loops create one pipeline and call pipeline.collide(...) before solver.step(...).

Constructor

CollisionPipeline(
    model: Model,
    broad_phase: BroadPhaseMode | str | None = None,
    *,
    reduce_contacts: bool = True,
    rigid_contact_max: int | None = None,
    shape_pairs_max: int | None = None,
    soft_contact_max: int | None = None,
    deterministic: bool = False,
    contact_matching: str = "disabled",
    contact_report: bool = False,
)
Parameter Description
model The Model the pipeline runs against.
broad_phase None to use the model default, a BroadPhaseMode, or one of "explicit", "nxn" / "all_pairs", "sap".
reduce_contacts Reduce candidate contact points to the solver-facing manifold set.
rigid_contact_max, shape_pairs_max, soft_contact_max Optional positive capacity overrides.
deterministic Enable deterministic ordering where supported.
contact_matching "disabled", "latest", or "sticky" frame-to-frame matching.
contact_report Allocate new / broken contact report buffers. Requires contact_matching != "disabled".

Properties

Property Description
broad_phase Read-only BroadPhaseMode used by this pipeline.
reduce_contacts Whether contact reduction is enabled.
deterministic Whether deterministic ordering is requested.
contact_matching Current matching mode name.
contact_report Whether report buffers are allocated.
rigid_contact_max, shape_pairs_max, soft_contact_max Resolved capacities.
last_candidate_pair_count, last_rigid_contact_overflow_count Diagnostics from the last collision pass.

Methods

Method Description
contacts() Allocate a Contacts aggregate sized for the bound model.
collide(state, contacts=None) Run collision detection against state. Populates and returns contacts, or allocates one when None.

Example

import novaphy

pipeline = novaphy.CollisionPipeline(model, broad_phase="sap")
contacts = pipeline.contacts()
pipeline.collide(state, contacts)
solver.step(state, state, control, contacts, dt)

Notes

  • Filter pairs are configured on the Model (via CollisionFilterPair entries passed to ModelBuilder); they apply globally regardless of which pipeline is in use.
  • This object is intentionally lightweight — copy it freely. The heavy lifting (broadphase tree, contact buffers) lives on the model and on the allocated Contacts.

See Also