getSATContacts

View sourcegetSATContacts(world: World): void

Builds the current 2D collision contacts from broadphase candidate pairs.

NarrowPhase2DPlugin registers this function directly in the repeating AppSchedule.Update schedule. It requires the CollisionPairs, SATNarrowphase2D, and Contacts resources. Its query accepts only entities with Position2D, Velocity2D, Rotation2D, Collider2D, and PhysicsProperties.

The system clears Contacts at the start of every run. It skips pair entries whose entities no longer satisfy the query or whose linked PhysicsProperties fail the collision filter. Accepted pairs wake both bodies, get a stable pair ID, and reuse their persistent manifold from SATNarrowphase2D when one already exists. The system resets and rebuilds that manifold’s collision data with the current collider shapes; non-overlapping or incomplete SAT results are not published to Contacts.

For a confirmed collision, the system updates the manifold’s restitution, kinetic friction, inverse masses, and inverse inertias from the two PhysicsProperties components before appending it to Contacts. The collision data’s overlap, axis, tangent, support vertices, contact points, and contact count are also rebuilt for the current update. The function returns no value; read the refreshed Contacts resource after the Update schedule reaches this system.

Examples

import { NarrowPhase2DPlugin, Contacts } from '@wimaengine/narrowphase'

// The plugin installs getSATContacts in AppSchedule.Update.
app.registerPlugin(new NarrowPhase2DPlugin())
// After an update, Contacts contains only the current confirmed contacts.
const contacts = world.getResource(Contacts)

Parameters

NameDescriptionDefault
world

World containing the collision-pair resource, SAT state, contacts, and queried body components.

—