getCollisionPairs

View sourcegetCollisionPairs(world: World): void

Rebuilds CollisionPairs from every unique pair of entities with EntityHandle and PhysicsHitbox.

The system clears CollisionPairs first, then tests each unordered combination with the inclusive intersectAABB2D check. Every overlapping pair is appended as a CollisionPair; this is broadphase candidate data, not a narrowphase collision result. Register it directly with App#registerSystem in an update schedule.

Examples

import { AppSchedule } from '@wimaengine/core'
import { getCollisionPairs, updateBroadphase2D } from '@wimaengine/broadphase'

app.registerSystem({ schedule: AppSchedule.Update, system: getCollisionPairs })
app.registerSystem({ schedule: AppSchedule.Update, system: updateBroadphase2D })

Parameters

NameDescriptionDefault
world

World whose CollisionPairs resource is rebuilt.

—