enable(object, debug, children)
This will create a P2 Physics body on the given game object or array of game objects.
A game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.
Note: When the game object is enabled for P2 physics it has its anchor x/y set to 0.5 so it becomes centered.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
object | object | array | Phaser.Group | The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a | ||
debug | boolean | <optional> | false | Create a debug object to go with this body? |
children | boolean | <optional> | true | Should a body be created on all children of this object? If true it will recurse down the display list as far as it can go. |
- Source code: physics/p2/World.js (Line 313)
Please login to continue.