Physics.P2.Body#setMaterial()

setMaterial(material, shape)

Adds the given Material to all Shapes that belong to this Body.
If you only wish to apply it to a specific Shape in this Body then provide that as the 2nd parameter.

Parameters
Name Type Argument Description
material Phaser.Physics.P2.Material

The Material that will be applied.

shape p2.Shape <optional>

An optional Shape. If not provided the Material will be added to all Shapes in this Body.

Source code: physics/p2/Body.js (Line 1272)
doc_phaser
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.