phaser
phaser copied to clipboard
Fix: `convertTilemapLayer` creating composite bodies unintentionally
This PR (delete as applicable)
- Fixes a bug
Describe the changes below:
There is an edge case that could cause a crash when using convertTilemapLayers
to create Matter.js bodies from a Tilemap. If any tiles had multiple colliders and you were providing some body creation options, the parts
property in the options would be modified and then concatenated with any bodies created after it. This would mean that some tiles would be combined when they shouldn't be, and on large maps would eventually hang once the convex hull got too big/complex.
This PR just clones the options
object before modifying it. You may already have a favoured way of doing this.
Maybe Clone() instead.
Thanks for this. I have implemented your fix and credited you in the Change Log.