piqnt / planck.js

2D JavaScript Physics Engine
http://piqnt.com/planck.js/
MIT License
4.87k stars 236 forks source link

ERROR changing a collider's mass cancels its linearVelocity #263

Closed quinton-ashley closed 12 months ago

quinton-ashley commented 1 year ago

Changing a collider's mass using body.setMassData cancels its linearVelocity. I think linearVelocity should be maintained in most cases. Perhaps there's a bug in how the collider's new linearVelocity is calculated.

shakiba commented 1 year ago

I guess it was fixed here

Are you using the latest version?

quinton-ashley commented 12 months ago

yeah I'm using v1 beta 15 planck.min.js

shakiba commented 12 months ago

Ops, that commit fixes resetMassData; setMassData was not fixed. I just fixed it and published the update.

quinton-ashley commented 12 months ago

Awesome! thank you 🙏🏻

shakiba commented 12 months ago

Thanks for reporting the issue!