use-cannon icon indicating copy to clipboard operation
use-cannon copied to clipboard

Dynamically update CompoundBody shapes

Open krispya opened this issue 2 years ago • 1 comments

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 avatar Sep 30 '21 01:09 krispya

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.

krispya avatar Oct 02 '21 21:10 krispya