Skip to content

novaphy.apply_particle_coupling_contacts

Apply particle / soft-point contact reactions from the Contacts.soft_contact_* channel back onto rigid bodies and articulation links. The channel is generated by CollisionPipeline.collide.

def apply_particle_coupling_contacts(
    contacts: Contacts,
    model: Model,
    state: SimState,
) -> None

Parameters

Parameter Description
contacts Aggregate whose soft-contact channel will be applied.
model Bound Model, used to look up rigid bodies and articulation links.
state Mutable SimState that receives body forces / torques and articulation wrenches.

Example

import novaphy

pbf   = novaphy.solvers.SolverPBF(model, pbf_config)
rigid = novaphy.solvers.SolverSemiImplicit(model)

state = model.state()
pbf.initialize_state(state)
control = model.control()
pipeline = novaphy.CollisionPipeline(model)
contacts = pipeline.contacts()

for _ in range(steps):
    pipeline.collide(state, contacts)
    pbf.step(state, state, None, contacts, dt)

    # SolverPBF calls apply_particle_coupling_contacts internally. Custom
    # fluid backends can call it here before the rigid step.
    pipeline.collide(state, contacts)
    rigid.step(state, state, control, contacts, dt)

Notes

  • This function consumes soft_contact_* rows; it does not run collision.
  • Calling it twice on the same contact rows doubles the applied force.
  • Built-in PBF/SPH solvers already invoke it when they receive a populated Contacts aggregate.

See Also