ObjectCollisionDetector

Object-to-object collision detector.

Detects whether two objects have been collided, and if yes in what way. Capable of detecting: * Box overlap * Box edge * Shape overlap Note that shape overlap needs a custom collision shape for it to work, and cannot be mirrored in any way, instead "pre-mirroring" has to be done. Also sprite scaling isn't supported by this very collision detector.

Constructors

this
this(void delegate(ObjectCollisionEvent event) objectToObjectCollision, int contextID)

Default CTOR that initializes the objectToObjectCollision, and contextID.

Members

Functions

testAll
void testAll()

Tests all shapes against each other

testCollision
ObjectCollisionEvent testCollision(CollisionShape* shA, CollisionShape* shB)

Tests two objects. Calls cl if collision have happened, with the appropriate values.

testSingle
void testSingle(int objectID)

Tests a single shape (objectID) against the others.

testSingle
void testSingle(int iA, CollisionShape* shA)

Tests a single shape against the others (internal).

Variables

contextID
int contextID;

Stores the identifier of this detector

objectToObjectCollision
void delegate(ObjectCollisionEvent event) objectToObjectCollision;

The delegate where the events will be passed. Must be set up before using the collision detector.

objects
ObjectMap objects;

Contains all of the objects

Meta