Closed wiledal closed 3 years ago
I have changed the setMass function according to @wiledal solution. It's working by setting shape type to 1 (dynamic) https://github.com/Franckapik/use-cannon/blob/update_mass/src/worker.js#L240
Thank you for your message here !! It help me a lot !
@stockHuman Is there a reason the version (v0.5.4) with this fix is not yet published on npmjs?
Hi @rrelmy. Yes, the package was renamed in September, to match others as a @react-three family. Per the first line in the readme: yarn add @react-three/cannon
will pull from npmjs. In the future, you'll see a deprecation warning when installing use-cannon
.
Problem
Calling
api.mass.set(x)
after a body is created does nothing.Possible solution
Add call to
body.updateMassProperties()
around here: https://github.com/pmndrs/use-cannon/blob/master/src/worker.js#L238As per documentation: https://schteppe.github.io/cannon.js/docs/classes/Body.html#method_updateMassProperties