Skip to content

Commit 0f207c4

Browse files
committed
Calling P2.Body.destroy or ArcadePhysics.Body.destroy wouldn't null the parent sprite body, causing it to error in the next update (thanks @jonathanhooker phaserjs#1077)
1 parent ec68786 commit 0f207c4

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ Version 2.1.0 - "Cairhien" - -in development-
125125
* Debug.cameraInfo no longer crashes if the camera bounds are nulled (thanks @wayfu #1143)
126126
* Camera.setBoundsToWorld no longer crashes if the camera bounds are nulled (thanks @wayfu #1143)
127127
* Fixed the resolution uniform type in the SampleFilter (thanks @VictoryRice #1137)
128+
* Calling P2.Body.destroy or ArcadePhysics.Body.destroy wouldn't null the parent sprite body, causing it to error in the next update (thanks @jonathanhooker #1077)
128129

129130
### p2.js 0.6.0 Changes and New Features
130131

src/physics/arcade/Body.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ Phaser.Physics.Arcade.Body.prototype = {
533533
*/
534534
destroy: function () {
535535

536+
this.sprite.body = null;
536537
this.sprite = null;
537538

538539
},

src/physics/p2/Body.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ Phaser.Physics.P2.Body.prototype = {
774774
}
775775

776776
this.debugBody = null;
777-
777+
this.sprite.body = null;
778778
this.sprite = null;
779779

780780
},

0 commit comments

Comments
 (0)