pmndrs / use-cannon

👋💣 physics based hooks for @react-three/fiber
https://cannon.pmnd.rs
2.76k stars 155 forks source link

Dynamically update CompoundBody shapes #288

Open krispya opened 3 years ago

krispya commented 3 years ago

I am trying to dynamically update the useCompoundBody shape so that the bounding box changes without having to reinitialize the component. Here is a CodeSandbox example: https://codesandbox.io/s/dynamically-update-compoundbody-nkzu0?file=/src/App.js

I expect that when the shape state changes that all the CompoundBody components update to match. Am I wrong to expect this? And if so, is there a preferred way to update the bounding box dynamically?

krispya commented 3 years ago

This was the closest I could come up with: https://codesandbox.io/s/dynamically-update-compoundbody-v2-4k93f?file=/src/App.js

Note the rotation issues will be fixed with the latest PR.