Following up on a recent discussion in the discord / this commit this PR fixes a small bug in the separate() function.
On these lines: https://github.com/phaserjs/phaser/blob/master/src/physics/arcade/World.js#L1946-L1950 - we see that the "detached" arcade body (the Body without a game object) is treated as a sprite (it isBody - unlike a sprite that has the body property .body) but in the processCallback this same dual nature of "sprite" in this context is not applied in reverse, the process callback will only pass back game objects, leading to potential bugs in consuming code trying to run a processCallback on their detached body colliders. This fix implements the same check in reverse, if the body has no gameObject (no sprite) the body itself will be returned to the callback, so that it can be executed/evaluated appropriately.
This PR
Describe the changes below:
Following up on a recent discussion in the discord / this commit this PR fixes a small bug in the
separate()
function.On these lines: https://github.com/phaserjs/phaser/blob/master/src/physics/arcade/World.js#L1946-L1950 - we see that the "detached" arcade body (the Body without a game object) is treated as a sprite (it
isBody
- unlike a sprite that has the body property.body
) but in the processCallback this same dual nature of "sprite" in this context is not applied in reverse, the process callback will only pass back game objects, leading to potential bugs in consuming code trying to run a processCallback on their detached body colliders. This fix implements the same check in reverse, if the body has no gameObject (no sprite) the body itself will be returned to the callback, so that it can be executed/evaluated appropriately.