novaphy.RecordedCollisionEvent¶
Single contact event captured by SimulationExporter.capture_frame. Logged once per active contact pair per frame, with the world-space contact geometry plus the penetration depth used by the rigid solver.
Attributes¶
| Attribute | Description |
|---|---|
time |
Simulation time [s]. |
body_a, body_b |
Body indices of the contacting pair (-1 may denote world / static plane). |
position |
Contact position in world coordinates [m]. |
normal |
Contact normal pointing from body A toward body B. |
penetration |
Penetration depth at the time of capture [m]. |
Example¶
import novaphy
import collections
exporter = novaphy.SimulationExporter()
# ... run simulation with capture_frame each step ...
# Histogram of contact pairs.
pair_counts = collections.Counter(
(ev.body_a, ev.body_b) for ev in exporter.collision_events
)
print(pair_counts.most_common(5))
Notes¶
- The event records the geometric penetration. Solver impulses are exposed
row-wise through Contacts fields such as
rigid_contact_accumulated_normal_impulse,rigid_contact_accumulated_tangent_impulse0, andrigid_contact_impulse.