fedoo.constraint.IPCContact.add_rigid_body

IPCContact.add_rigid_body(rigid_body, surface_node_indices=None)

Register a RigidBody with this IPCContact.

This optional convenience enables direct reduced-coordinate projection for rigid-vs-deformable (or rigid-vs-rigid) contact where a single IPCContact carries the full collision mesh. The body’s surface nodes are routed onto the 6 rigid-body global DOFs by the scatter matrix via the exact rigid Jacobian J = [I_3 | dR/d(omega) @ r_ref], instead of placing forces at the per-node mesh DOFs.

Registration is not required for correctness when the rigid surface nodes already belong to the contact mesh and a RigidTie is attached to the problem. In that generic path, IPC assembles nodal contact contributions and the problem’s MPC condensation projects them onto the rigid DOFs. Registration additionally associates the body with the shared mesh and lets automatic barrier-stiffness estimation account for generalized rigid-body forces directly.

For rigid-vs-static contact (rigid body bouncing on a fixed floor), use RigidBody.set_static_obstacle() instead — that path uses a private 6x6 fast route with no shared mesh.

Parameters:
  • rigid_body (RigidBody) – The rigid body. When the body’s nodes live inside this IPCContact’s mesh (stacked rigid-plus-deformable case), construct it from a Mesh.extract_elements() of the shared mesh so the carried parent_node_indices wires RigidTie to the correct parent DOFs. rigid_body.constraint.list_nodes is read as the default surface index set.

  • surface_node_indices (array_like, optional) – Override for rigid_body.constraint.list_nodes. Rarely needed; useful only when the rigid body’s surface is a strict subset of its tie node set.