A manager to efficiently detect object-intersections in 2D.

Usage looks like this:

const collision = new CollisionEngine();

// add static collider
collision.addCollider(Collider.createStatic().addShape(new CollisionCircle().setValues(310, 310, 100)));
// add dyanmic collider
collision.addCollider(Collider.createDynamic().addShape(new CollisionLine().setValues(310, 310, 500, 310)));

// scan for collision
const scanRect = new CollisionRect(0, 0, 100, 50);
const contacts = collision.scan(scanRect);

Instances of CollisionContact are part of object pooling. Please check CollisionContact docs for details.

See

CollisionContact

Hierarchy

  • CollisionEngine

Constructors

Properties

_debugDrawer: CollisionEngineDebugDrawerImpl = null
_poolContact: CollisionContact[] = []
_poolContactsUsed: number = 0
_tmpCollectors: Collider[] = []
debugDrawOptions: DebugSettings = DebugSettings.Recents
dynamicCollider: Collider[] = []
staticColliders: QuadTree = ...
statisticCountChecks: number = 0

Methods

Generated using TypeDoc