createGroupCallback(group, callback, callbackContext)
Sets a callback to be fired any time this Body impacts with the given Group. The impact test is performed against shape.collisionGroup values.
The callback will be sent 4 parameters: This body, the body that impacted, the Shape in this body and the shape in the impacting body.
This callback will only fire if this Body has been assigned a collision group.
Note that the impact event happens after collision resolution, so it cannot be used to prevent a collision from happening.
It also happens mid-step. So do not destroy a Body during this callback, instead set safeDestroy to true so it will be killed on the next preUpdate.
Parameters
Name | Type | Description |
---|---|---|
group | Phaser.Physics.CollisionGroup | The Group to send impact events for. |
callback | function | The callback to fire on impact. Set to null to clear a previously set callback. |
callbackContext | object | The context under which the callback will fire. |
- Source code: physics/p2/Body.js (Line 220)
Please login to continue.