Skip to content

Commit 4910f27

Browse files
committed
You can now over-ride the pxm and mpx functions with your own via the physics config object.
1 parent cb5a8c7 commit 4910f27

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/physics/p2/World.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ Phaser.Physics.P2 = function (game, config) {
120120
*/
121121
this.onEndContact = new Phaser.Signal();
122122

123+
// Pixel to meter function overrides
124+
if (config.hasOwnProperty('mpx') && config.hasOwnProperty('pxm') && config.hasOwnProperty('mpxi') && config.hasOwnProperty('pxmi'))
125+
{
126+
this.mpx = config.mpx;
127+
this.mpxi = config.mpxi;
128+
this.pxm = config.pxm;
129+
this.pxmi = config.pxmi;
130+
}
131+
123132
// Hook into the World events
124133
this.world.on("postStep", this.postStepHandler, this);
125134
this.world.on("postBroadphase", this.postBroadphaseHandler, this);

0 commit comments

Comments
 (0)