novaphy.SweepAndPrune¶
Sweep-and-Prune broadphase collision detector. NovaPhy's only Python-
exposed broadphase today (BVH and AllPairs exist in C++ but are not
bound). Newton's equivalent class is named BroadPhaseSAP.
Constructor¶
Methods¶
| Method | Description |
|---|---|
update(body_aabbs, static_mask) |
Update overlap candidates from current world-space AABBs. static_mask[i] == True marks body i as static, so static-static pairs are pruned. |
get_pairs() |
Return the latest list of BroadPhasePair entries. |
Example¶
import novaphy
sap = novaphy.SweepAndPrune()
# Build per-body AABBs (e.g. from CollisionShape.compute_aabb).
sap.update(world_aabbs, static_mask=[False] * len(world_aabbs))
pairs = sap.get_pairs()
print(len(pairs), "candidate overlap pairs")
Notes¶
updatere-sorts the endpoint lists internally; you can call it every frame without rebuilding state.- For full simulation use, prefer CollisionPipeline — it wires SaP and the narrowphase together with the broadphase already configured on the bound model.