Skip to content

Commit

Permalink
Calling Arcade Physics collide during an update method wouldn't i…
Browse files Browse the repository at this point in the history
…nject the results back into the Body parent, causing the bodies to carry on moving. Using Colliders worked, but manually checking did not. Now, both methods work. Fix #3777
  • Loading branch information
photonstorm committed Aug 29, 2018
1 parent 00b9da4 commit 14d3f6b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/physics/arcade/StaticBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,16 @@ var StaticBody = new Class({
return (this.isCircle) ? CircleContains(this, x, y) : RectangleContains(this, x, y);
},

/**
* NOOP
*
* @method Phaser.Physics.Arcade.StaticBody#postUpdate
* @since 3.12.0
*/
postUpdate: function ()
{
},

/**
* [description]
*
Expand Down
10 changes: 8 additions & 2 deletions src/physics/arcade/World.js
Original file line number Diff line number Diff line change
Expand Up @@ -1457,9 +1457,15 @@ var World = new Class({
{
this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2);
}
else if (body1.onCollide || body2.onCollide)
else
{
this.emit('collide', body1.gameObject, body2.gameObject, body1, body2);
body1.postUpdate();
body2.postUpdate();

if (body1.onCollide || body2.onCollide)
{
this.emit('collide', body1.gameObject, body2.gameObject, body1, body2);
}
}
}

Expand Down

0 comments on commit 14d3f6b

Please sign in to comment.