phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
36.94k stars 7.08k forks source link

Phaser arcade physics allows unacceptable levels of interpenetration, causes different masses of objects to fly away #5687

Closed lackhand closed 7 months ago

lackhand commented 3 years ago

Version

Description

See frequent discussion of object interpenetration & recent complaints of asymmetric mass flyaways. I've built a codepen test playground to show off specific problems: https://codepen.io/browndragon/pen/qBrBaxq Note that pushing a column of blocks up (which is heavy->mid->light) causes the entire stack to flyaway. (heavy has mass 32, mid has mass 1, light has mass 1/32, and all have significant damping applied).

Note that pushing a row heavy->heavy->heavy inevitably causes interpenetration.

Other physical aberrations are also visible!

I've also included a more complex playground with additional examples of configuration, including immovable walls, platforms, and some unpushable objects: https://codepen.io/browndragon/pen/KKWdzpr . This is useful for testing whether corner cases are handled/better/worse in the new version, but it's pretty chaotic so I have a hard time using it to prove my point :-D

Example Test Code

https://codepen.io/browndragon/pen/qBrBaxq -- see discussion above for the repro instructions. Then, for additional intersection behaviors, https://codepen.io/browndragon/pen/KKWdzpr (but it's a lot more chaotic!).

Additional Information

https://github.com/browndragon/phaser/tree/newArcade running against the same test frame produces significantly better results IMO (is there an easier way to get the demo running for you? I guess I could figure out how to package it up and stick it on itch.io or smth :-D )

However, I did not attempt to make this the minimum bug-pickable arcade solution, since I know there's some concern about taking massive fixes back upstream. I'm very happy to work with you to get this acceptable if the performance seems acceptable.

lackhand commented 3 years ago

Oh and fyi if the easiest solution is for me to fork this and provide "arcade2" as a plugin, if you'll bless the extraction, I'm happy to take that way out!

photonstorm commented 7 months ago

As reluctant as I am to close this, because you kindly offered to help fix lots of Arcades short-comings, it was sadly during a period when I could not focus on Phaser much, so the offer was left to linger. As it stands now, Arcades days are numbered anyway, and hopefully soon to be replaced entirely, so in a case of house-keeping, I'm going to thank you but close this issue off.