new Physics(game, physicsConfig)
The Physics Manager is responsible for looking after all of the running physics systems.
Phaser supports 4 physics systems: Arcade Physics, P2, Ninja Physics and Box2D via a commercial plugin.
Game Objects (such as Sprites) can only belong to 1 physics system, but you can have multiple systems active in a single game.
For example you could have P2 managing a polygon-built terrain landscape that an vehicle drives over, while it could be firing bullets that use the
faster (due to being much simpler) Arcade Physics system.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
game | Phaser.Game | A reference to the currently running game. | ||
physicsConfig | object | <optional> | null | A physics configuration object to pass to the Physics world on creation. |
- Source code: physics/Physics.js (Line 21)
Please login to continue.