Skip to content

Commit

Permalink
Setting a P2.Body from Static or Kinematic to Dynamic will now automa…
Browse files Browse the repository at this point in the history
…tically adjust the Body.mass to be 1 (thanks @wayfu #2005)
  • Loading branch information
photonstorm committed Aug 20, 2015
1 parent 994a7da commit 55a7699
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
* VideoStream.active = false is used if the browser supports it, otherwise it falls back to VideoStream.stop.
* Text can now accept `undefined` or `null` as the `text` argument in the constructor and will cast it as an empty string.
* Point.rotate uses a faster and simpler rotation function when no distance argument is specified.
* Setting a P2.Body from Static or Kinematic to Dynamic will now automatically adjust the Body.mass to be 1 (thanks @wayfu #2005)

### Bug Fixes

Expand Down
12 changes: 2 additions & 10 deletions src/physics/p2/Body.js
Original file line number Diff line number Diff line change
Expand Up @@ -1434,11 +1434,7 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "static", {
else if (!value && this.data.type === Phaser.Physics.P2.Body.STATIC)
{
this.data.type = Phaser.Physics.P2.Body.DYNAMIC;

if (this.mass === 0)
{
this.mass = 1;
}
this.mass = 1;
}

}
Expand All @@ -1462,11 +1458,7 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "dynamic", {
if (value && this.data.type !== Phaser.Physics.P2.Body.DYNAMIC)
{
this.data.type = Phaser.Physics.P2.Body.DYNAMIC;

if (this.mass === 0)
{
this.mass = 1;
}
this.mass = 1;
}
else if (!value && this.data.type === Phaser.Physics.P2.Body.DYNAMIC)
{
Expand Down

0 comments on commit 55a7699

Please sign in to comment.