pmndrs / use-cannon

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

Unstable Cannon body in a loop #136

Closed tommhuth closed 3 years ago

tommhuth commented 3 years ago

When using a component with physics in a loop, the position of the Cannon body is unstable when new elements are added. See https://codesandbox.io/s/unstable-boxes3-3n1fd where the boxes are placed randomly at a set interval, but they will often jump around.

I reported this a while back but it got moved to discussions where it seems to have died. I was hopeful an upgraded version of use-cannon could have fixed the problem, but alas. My intent is not to spam this repo with duplicates but this seems like such a basic use case in a React setting that it would be nice with a clarification on where this issue stand: Is this a bug with use-cannon, or is simply using physics integration in a component in a loop like this something that should be avoided?