@@ -14383,12 +14383,19 @@ Phaser.Physics.P2.prototype = {
1438314383 * Adds a Spring to the world.
1438414384 *
1438514385 * @method Phaser.Physics.P2#addSpring
14386- * @param {Phaser.Physics.P2.Spring} spring - The Spring to add to the World.
14386+ * @param {Phaser.Physics.P2.Spring|p2.LinearSpring|p2.RotationalSpring } spring - The Spring to add to the World.
1438714387 * @return {Phaser.Physics.P2.Spring} The Spring that was added.
1438814388 */
1438914389 addSpring: function (spring) {
1439014390
14391- this.world.addSpring(spring);
14391+ if (spring instanceof Phaser.Physics.P2.Spring || spring instanceof Phaser.Physics.P2.RotationalSpring)
14392+ {
14393+ this.world.addSpring(spring.data);
14394+ }
14395+ else
14396+ {
14397+ this.world.addSpring(spring);
14398+ }
1439214399
1439314400 this.onSpringAdded.dispatch(spring);
1439414401
@@ -14405,7 +14412,14 @@ Phaser.Physics.P2.prototype = {
1440514412 */
1440614413 removeSpring: function (spring) {
1440714414
14408- this.world.removeSpring(spring);
14415+ if (spring instanceof Phaser.Physics.P2.Spring || spring instanceof Phaser.Physics.P2.RotationalSpring)
14416+ {
14417+ this.world.removeSpring(spring.data);
14418+ }
14419+ else
14420+ {
14421+ this.world.removeSpring(spring);
14422+ }
1440914423
1441014424 this.onSpringRemoved.dispatch(spring);
1441114425
@@ -15740,13 +15754,13 @@ Phaser.Physics.P2.PointProxy.prototype.constructor = Phaser.Physics.P2.PointProx
1574015754
1574115755/**
1574215756* @name Phaser.Physics.P2.PointProxy#x
15743- * @property {number} x - The x property of this PointProxy.
15757+ * @property {number} x - The x property of this PointProxy get and set in pixels .
1574415758*/
1574515759Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "x", {
1574615760
1574715761 get: function () {
1574815762
15749- return this.destination[0];
15763+ return this.world.mpx(this. destination[0]) ;
1575015764
1575115765 },
1575215766
@@ -15760,13 +15774,13 @@ Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "x", {
1576015774
1576115775/**
1576215776* @name Phaser.Physics.P2.PointProxy#y
15763- * @property {number} y - The y property of this PointProxy.
15777+ * @property {number} y - The y property of this PointProxy get and set in pixels .
1576415778*/
1576515779Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "y", {
1576615780
1576715781 get: function () {
1576815782
15769- return this.destination[1];
15783+ return this.world.mpx(this. destination[1]) ;
1577015784
1577115785 },
1577215786
@@ -15778,6 +15792,46 @@ Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "y", {
1577815792
1577915793});
1578015794
15795+ /**
15796+ * @name Phaser.Physics.P2.PointProxy#mx
15797+ * @property {number} mx - The x property of this PointProxy get and set in meters.
15798+ */
15799+ Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "mx", {
15800+
15801+ get: function () {
15802+
15803+ return this.destination[0];
15804+
15805+ },
15806+
15807+ set: function (value) {
15808+
15809+ this.destination[0] = value;
15810+
15811+ }
15812+
15813+ });
15814+
15815+ /**
15816+ * @name Phaser.Physics.P2.PointProxy#my
15817+ * @property {number} my - The x property of this PointProxy get and set in meters.
15818+ */
15819+ Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "my", {
15820+
15821+ get: function () {
15822+
15823+ return this.destination[1];
15824+
15825+ },
15826+
15827+ set: function (value) {
15828+
15829+ this.destination[1] = value;
15830+
15831+ }
15832+
15833+ });
15834+
1578115835/**
1578215836* @author Richard Davey <rich@photonstorm.com>
1578315837* @copyright 2014 Photon Storm Ltd.
@@ -15804,30 +15858,70 @@ Phaser.Physics.P2.InversePointProxy.prototype.constructor = Phaser.Physics.P2.In
1580415858
1580515859/**
1580615860* @name Phaser.Physics.P2.InversePointProxy#x
15807- * @property {number} x - The x property of this InversePointProxy.
15861+ * @property {number} x - The x property of this InversePointProxy get and set in pixels .
1580815862*/
1580915863Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "x", {
1581015864
1581115865 get: function () {
1581215866
15813- return this.destination[0];
15867+ return this.world.mpxi(this. destination[0]) ;
1581415868
1581515869 },
1581615870
1581715871 set: function (value) {
1581815872
15819- this.destination[0] = this.world.pxm(- value);
15873+ this.destination[0] = this.world.pxmi( value);
1582015874
1582115875 }
1582215876
1582315877});
1582415878
1582515879/**
1582615880* @name Phaser.Physics.P2.InversePointProxy#y
15827- * @property {number} y - The y property of this InversePointProxy.
15881+ * @property {number} y - The y property of this InversePointProxy get and set in pixels .
1582815882*/
1582915883Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "y", {
1583015884
15885+ get: function () {
15886+
15887+ return this.world.mpxi(this.destination[1]);
15888+
15889+ },
15890+
15891+ set: function (value) {
15892+
15893+ this.destination[1] = this.world.pxmi(value);
15894+
15895+ }
15896+
15897+ });
15898+
15899+ /**
15900+ * @name Phaser.Physics.P2.InversePointProxy#mx
15901+ * @property {number} mx - The x property of this InversePointProxy get and set in meters.
15902+ */
15903+ Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "mx", {
15904+
15905+ get: function () {
15906+
15907+ return this.destination[0];
15908+
15909+ },
15910+
15911+ set: function (value) {
15912+
15913+ this.destination[0] = -value;
15914+
15915+ }
15916+
15917+ });
15918+
15919+ /**
15920+ * @name Phaser.Physics.P2.InversePointProxy#my
15921+ * @property {number} my - The y property of this InversePointProxy get and set in meters.
15922+ */
15923+ Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "my", {
15924+
1583115925 get: function () {
1583215926
1583315927 return this.destination[1];
@@ -15836,7 +15930,7 @@ Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "y", {
1583615930
1583715931 set: function (value) {
1583815932
15839- this.destination[1] = this.world.pxm( -value) ;
15933+ this.destination[1] = -value;
1584015934
1584115935 }
1584215936
@@ -17588,6 +17682,8 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "debug", {
1758817682/**
1758917683* A Body can be set to collide against the World bounds automatically if this is set to true. Otherwise it will leave the World.
1759017684* Note that this only applies if your World has bounds! The response to the collision should be managed via CollisionMaterials.
17685+ * Also note that when you set this it will only effect Body shapes that already exist. If you then add further shapes to your Body
17686+ * after setting this it will *not* proactively set them to collide with the bounds.
1759117687*
1759217688* @name Phaser.Physics.P2.Body#collideWorldBounds
1759317689* @property {boolean} collideWorldBounds - Should the Body collide with the World bounds?
@@ -18112,11 +18208,13 @@ Phaser.Physics.P2.Spring = function (world, bodyA, bodyB, restLength, stiffness,
1811218208 options.localAnchorB = [ world.pxm(localB[0]), world.pxm(localB[1]) ];
1811318209 }
1811418210
18115- p2.LinearSpring.call(this, bodyA, bodyB, options);
18211+ /**
18212+ * @property {p2.LinearSpring} data - The actual p2 spring object.
18213+ */
18214+ this.data = new p2.LinearSpring(bodyA, bodyB, options);
1811618215
1811718216};
1811818217
18119- Phaser.Physics.P2.Spring.prototype = Object.create(p2.LinearSpring.prototype);
1812018218Phaser.Physics.P2.Spring.prototype.constructor = Phaser.Physics.P2.Spring;
1812118219
1812218220/**
@@ -18165,11 +18263,13 @@ Phaser.Physics.P2.RotationalSpring = function (world, bodyA, bodyB, restAngle, s
1816518263 damping: damping
1816618264 };
1816718265
18168- p2.RotationalSpring.call(this, bodyA, bodyB, options);
18266+ /**
18267+ * @property {p2.RotationalSpring} data - The actual p2 spring object.
18268+ */
18269+ this.data = new p2.RotationalSpring(bodyA, bodyB, options);
1816918270
1817018271};
1817118272
18172- Phaser.Physics.P2.Spring.prototype = Object.create(p2.RotationalSpring.prototype);
1817318273Phaser.Physics.P2.Spring.prototype.constructor = Phaser.Physics.P2.Spring;
1817418274
1817518275/**
0 commit comments