createMaterial(name, body) → {Phaser.Physics.P2.Material}
Creates a Material. Materials are applied to Shapes owned by a Body and can be set with Body.setMaterial().
Materials are a way to control what happens when Shapes collide. Combine unique Materials together to create Contact Materials.
Contact Materials have properties such as friction and restitution that allow for fine-grained collision control between different Materials.
Parameters
Name | Type | Argument | Description |
---|---|---|---|
name | string | <optional> | Optional name of the Material. Each Material has a unique ID but string names are handy for debugging. |
body | Phaser.Physics.P2.Body | <optional> | Optional Body. If given it will assign the newly created Material to the Body shapes. |
Returns
The Material that was created. This is also stored in Phaser.Physics.P2.materials.
- Source code: physics/p2/World.js (Line 1219)
Please login to continue.