Skip to content

Commit f64d3e5

Browse files
committed
Per-body collision callbacks
1 parent 0d62f60 commit f64d3e5

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/physics/matter-js/lib/plugins/MatterCollisionEvents.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ var MatterCollisionEvents = {
3434
{
3535
bodyB.onCollideCallback(pair);
3636
}
37+
38+
if (bodyA.onCollideWith[bodyB.id])
39+
{
40+
bodyA.onCollideWith[bodyB.id](bodyB, pair);
41+
}
42+
43+
if (bodyB.onCollideWith[bodyA.id])
44+
{
45+
bodyB.onCollideWith[bodyA.id](bodyA, pair);
46+
}
3747
});
3848
});
3949

0 commit comments

Comments
 (0)