mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 12:43:26 +00:00
Create MatterCollisionEvents.md
This commit is contained in:
parent
3ca2e6838a
commit
26510d9716
1 changed files with 23 additions and 0 deletions
23
changelog/3.85/MatterCollisionEvents.md
Normal file
23
changelog/3.85/MatterCollisionEvents.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Phaser 3.85.0 Change Log
|
||||
|
||||
Return to the [Change Log index](CHANGELOG-v3.85.md).
|
||||
|
||||
# `MatterCollisionEvents` integration
|
||||
|
||||
Integrated `MatterCollisionEvents` plugin functionality directly into the `Matter.World` class to handle collision events (`collisionStart`, `collisionActive`, and `collisionEnd`) more effectively.
|
||||
|
||||
Three new events are available on `Matter.Body`:
|
||||
1. `onCollide`
|
||||
2. `onCollideEnd`
|
||||
3. `onCollideActive`
|
||||
|
||||
These events correspond to the Matter events `collisionStart`, `collisionActive` and `collisionEnd`, respectively.
|
||||
|
||||
You can listen to these events via `Matter.Events` or they will also be emitted from the Matter World.
|
||||
|
||||
Also added to `Matter.Body` are three convenience functions:
|
||||
- `Matter.Body.setOnCollide(callback)`
|
||||
- `Matter.Body.setOnCollideEnd(callback)`
|
||||
- `Matter.Body.setOnCollideActive(callback)`
|
||||
|
||||
To register an event callback, provide a function of type `(pair: Matter.Pair) => void`.
|
Loading…
Reference in a new issue