Skip to content

Commit 98ccae5

Browse files
committed
P2.Body now uses the new Body.type value instead of Body.motionState, however as P2.Body already have a property called type we have left the motionState getter/setter in for now.
1 parent 4935a4e commit 98ccae5

2 files changed

Lines changed: 56 additions & 26 deletions

File tree

README.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ Version 2.1.0 - "Cairhien" - -in development-
7373
* TypeScript definition updates to help fix for the `noimplicitany` option (thanks @Waog #1088)
7474
* All of the Pixi geom classes have been removed from the build file as they aren't needed (the Phaser.Geom classes overwrite them), saving some space in the process.
7575

76-
### p2.js changes
77-
78-
* DistanceConstraint signature changed to take the new localAnchors.
79-
* RevoluteConstraint signature changed to include worldPivot
80-
8176
### New Features
8277

8378
* Device will now detect for Kindle and PS Vita (thanks @lucbloom)
@@ -96,6 +91,41 @@ Version 2.1.0 - "Cairhien" - -in development-
9691
* Group.swap() updates the Z index values properly (thanks @Blank101 #1090)
9792
* Device now recognises ChromeOS as a desktop (thanks @alvinsight @hilts-vaughan #1091)
9893

94+
### p2.js 0.6.0 Changes
95+
96+
* DistanceConstraint signature changed to take the new localAnchors.
97+
* RevoluteConstraint signature changed to include worldPivot
98+
* P2.Body now uses the new Body.type value instead of Body.motionState, however as P2.Body already have a property called `type` we have left the `motionState` getter/setter in for now.
99+
100+
#### Breaking changes
101+
102+
* Renamed property .motionState to .type in class Body.
103+
* Changed constructor of RevoluteConstraint. Now the local pivots are passed as options instead of direct arguments. See the constraints demo.
104+
* Removed World.prototype.toJSON and .fromJSON.
105+
* Removed properties .enableBodySleeping and .enableIslandSleeping from World instances. The enum .sleepMode can be used instead. See the sleep demo.
106+
* Converted Spring to a base class for the new LinearSpring and RotationalSpring classes. LinearSpring can be used as the old Spring.
107+
* Utils.ARRAY_TYPE can now be overridden by injecting a global called P2_ARRAY_TYPE. Support for GLMAT_ARRAY_TYPE has been removed.
108+
109+
#### Other changes
110+
111+
* Added flag .enableFrictionReduction to Narrowphase.
112+
* Added RevoluteConstraint.prototype.setLimits.
113+
* Added PrismaticConstraint.prototype.setLimits.
114+
* LockConstraint, DistanceConstraint, and GearConstraint can now be constructed from current body transforms.
115+
* RevoluteConstraint can now be constructed from the current body transforms and a world point.
116+
* Material id can now be passed via constructor.
117+
* ContactMaterial instances now have a property .contactSkinSize.
118+
* Added method Body.prototype.getAABB.
119+
* Limits for DistanceConstraint. See the DistanceConstraint demo.
120+
* Added Body.prototype.overlaps.
121+
* Added class OverlapKeeper.
122+
* If substepping is used in World.prototype.step, the substeps are aborted if slower than real time.
123+
* Added Heightfield/Convex and Heightfield/Circle collision support.
124+
* Added property .overlapKeeper to World.
125+
* EventEmitter.prototype.has can now check if any listeners were added to a given topic.
126+
* Added Utils.defaults.
127+
128+
99129
The full Change Log is at https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md
100130

101131
![div](http://phaser.io/images/div3.png)

src/physics/p2/Body.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,23 +1299,23 @@ Phaser.Physics.P2.Body.prototype = {
12991299
Phaser.Physics.P2.Body.prototype.constructor = Phaser.Physics.P2.Body;
13001300

13011301
/**
1302-
* Dynamic body.
1302+
* Dynamic body. Dynamic bodies body can move and respond to collisions and forces.
13031303
* @property DYNAMIC
13041304
* @type {Number}
13051305
* @static
13061306
*/
13071307
Phaser.Physics.P2.Body.DYNAMIC = 1;
13081308

13091309
/**
1310-
* Static body.
1310+
* Static body. Static bodies do not move, and they do not respond to forces or collision.
13111311
* @property STATIC
13121312
* @type {Number}
13131313
* @static
13141314
*/
13151315
Phaser.Physics.P2.Body.STATIC = 2;
13161316

13171317
/**
1318-
* Kinematic body.
1318+
* Kinematic body. Kinematic bodies only moves according to its .velocity, and does not respond to collisions or force.
13191319
* @property KINEMATIC
13201320
* @type {Number}
13211321
* @static
@@ -1330,20 +1330,20 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "static", {
13301330

13311331
get: function () {
13321332

1333-
return (this.data.motionState === Phaser.Physics.P2.Body.STATIC);
1333+
return (this.data.type === Phaser.Physics.P2.Body.STATIC);
13341334

13351335
},
13361336

13371337
set: function (value) {
13381338

1339-
if (value && this.data.motionState !== Phaser.Physics.P2.Body.STATIC)
1339+
if (value && this.data.type !== Phaser.Physics.P2.Body.STATIC)
13401340
{
1341-
this.data.motionState = Phaser.Physics.P2.Body.STATIC;
1341+
this.data.type = Phaser.Physics.P2.Body.STATIC;
13421342
this.mass = 0;
13431343
}
1344-
else if (!value && this.data.motionState === Phaser.Physics.P2.Body.STATIC)
1344+
else if (!value && this.data.type === Phaser.Physics.P2.Body.STATIC)
13451345
{
1346-
this.data.motionState = Phaser.Physics.P2.Body.DYNAMIC;
1346+
this.data.type = Phaser.Physics.P2.Body.DYNAMIC;
13471347

13481348
if (this.mass === 0)
13491349
{
@@ -1363,24 +1363,24 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "dynamic", {
13631363

13641364
get: function () {
13651365

1366-
return (this.data.motionState === Phaser.Physics.P2.Body.DYNAMIC);
1366+
return (this.data.type === Phaser.Physics.P2.Body.DYNAMIC);
13671367

13681368
},
13691369

13701370
set: function (value) {
13711371

1372-
if (value && this.data.motionState !== Phaser.Physics.P2.Body.DYNAMIC)
1372+
if (value && this.data.type !== Phaser.Physics.P2.Body.DYNAMIC)
13731373
{
1374-
this.data.motionState = Phaser.Physics.P2.Body.DYNAMIC;
1374+
this.data.type = Phaser.Physics.P2.Body.DYNAMIC;
13751375

13761376
if (this.mass === 0)
13771377
{
13781378
this.mass = 1;
13791379
}
13801380
}
1381-
else if (!value && this.data.motionState === Phaser.Physics.P2.Body.DYNAMIC)
1381+
else if (!value && this.data.type === Phaser.Physics.P2.Body.DYNAMIC)
13821382
{
1383-
this.data.motionState = Phaser.Physics.P2.Body.STATIC;
1383+
this.data.type = Phaser.Physics.P2.Body.STATIC;
13841384
this.mass = 0;
13851385
}
13861386

@@ -1396,20 +1396,20 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "kinematic", {
13961396

13971397
get: function () {
13981398

1399-
return (this.data.motionState === Phaser.Physics.P2.Body.KINEMATIC);
1399+
return (this.data.type === Phaser.Physics.P2.Body.KINEMATIC);
14001400

14011401
},
14021402

14031403
set: function (value) {
14041404

1405-
if (value && this.data.motionState !== Phaser.Physics.P2.Body.KINEMATIC)
1405+
if (value && this.data.type !== Phaser.Physics.P2.Body.KINEMATIC)
14061406
{
1407-
this.data.motionState = Phaser.Physics.P2.Body.KINEMATIC;
1407+
this.data.type = Phaser.Physics.P2.Body.KINEMATIC;
14081408
this.mass = 4;
14091409
}
1410-
else if (!value && this.data.motionState === Phaser.Physics.P2.Body.KINEMATIC)
1410+
else if (!value && this.data.type === Phaser.Physics.P2.Body.KINEMATIC)
14111411
{
1412-
this.data.motionState = Phaser.Physics.P2.Body.STATIC;
1412+
this.data.type = Phaser.Physics.P2.Body.STATIC;
14131413
this.mass = 0;
14141414
}
14151415

@@ -1621,15 +1621,15 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "motionState", {
16211621

16221622
get: function () {
16231623

1624-
return this.data.motionState;
1624+
return this.data.type;
16251625

16261626
},
16271627

16281628
set: function (value) {
16291629

1630-
if (value !== this.data.motionState)
1630+
if (value !== this.data.type)
16311631
{
1632-
this.data.motionState = value;
1632+
this.data.type = value;
16331633
}
16341634

16351635
}

0 commit comments

Comments
 (0)