Skip to content

Commit 6acc8bf

Browse files
committed
World.enableBodySleeping has been removed and replaced with World.sleepMode.
1 parent 98ccae5 commit 6acc8bf

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Version 2.1.0 - "Cairhien" - -in development-
9696
* DistanceConstraint signature changed to take the new localAnchors.
9797
* RevoluteConstraint signature changed to include worldPivot
9898
* 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+
* World.enableBodySleeping has been removed and replaced with World.sleepMode.
99100

100101
#### Breaking changes
101102

@@ -125,7 +126,6 @@ Version 2.1.0 - "Cairhien" - -in development-
125126
* EventEmitter.prototype.has can now check if any listeners were added to a given topic.
126127
* Added Utils.defaults.
127128

128-
129129
The full Change Log is at https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md
130130

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

src/physics/p2/World.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,15 +1191,15 @@ Phaser.Physics.P2.prototype = {
11911191

11921192
while (i--)
11931193
{
1194-
if (bodies[i] instanceof Phaser.Physics.P2.Body && !(filterStatic && bodies[i].data.motionState === p2.Body.STATIC))
1194+
if (bodies[i] instanceof Phaser.Physics.P2.Body && !(filterStatic && bodies[i].data.type === p2.Body.STATIC))
11951195
{
11961196
query.push(bodies[i].data);
11971197
}
1198-
else if (bodies[i] instanceof p2.Body && bodies[i].parent && !(filterStatic && bodies[i].motionState === p2.Body.STATIC))
1198+
else if (bodies[i] instanceof p2.Body && bodies[i].parent && !(filterStatic && bodies[i].type === p2.Body.STATIC))
11991199
{
12001200
query.push(bodies[i]);
12011201
}
1202-
else if (bodies[i] instanceof Phaser.Sprite && bodies[i].hasOwnProperty('body') && !(filterStatic && bodies[i].body.data.motionState === p2.Body.STATIC))
1202+
else if (bodies[i] instanceof Phaser.Sprite && bodies[i].hasOwnProperty('body') && !(filterStatic && bodies[i].body.data.type === p2.Body.STATIC))
12031203
{
12041204
query.push(bodies[i].body.data);
12051205
}
@@ -1841,20 +1841,22 @@ Object.defineProperty(Phaser.Physics.P2.prototype, "emitImpactEvent", {
18411841
});
18421842

18431843
/**
1844-
* @name Phaser.Physics.P2#enableBodySleeping
1845-
* @property {boolean} enableBodySleeping - Enable / disable automatic body sleeping.
1844+
* How to deactivate bodies during simulation. Possible modes are: World.NO_SLEEPING, World.BODY_SLEEPING and World.ISLAND_SLEEPING.
1845+
* If sleeping is enabled, you might need to wake up the bodies if they fall asleep when they shouldn't. If you want to enable sleeping in the world, but want to disable it for a particular body, see Body.allowSleep.
1846+
* @name Phaser.Physics.P2#sleepMode
1847+
* @property {number} sleepMode
18461848
*/
1847-
Object.defineProperty(Phaser.Physics.P2.prototype, "enableBodySleeping", {
1849+
Object.defineProperty(Phaser.Physics.P2.prototype, "sleepMode", {
18481850

18491851
get: function () {
18501852

1851-
return this.world.enableBodySleeping;
1853+
return this.world.sleepMode;
18521854

18531855
},
18541856

18551857
set: function (value) {
18561858

1857-
this.world.enableBodySleeping = value;
1859+
this.world.sleepMode = value;
18581860

18591861
}
18601862

0 commit comments

Comments
 (0)