pmndrs / use-cannon

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

fixes bodies sync bug #155

Closed simonghales closed 3 years ago

simonghales commented 3 years ago

This should resolve this issue: https://github.com/pmndrs/use-cannon/discussions/96

fixes a small bug where whenever the bodies need to be synchronized, the next 'frame' update might arrive before the 'sync' update is received and processed.

This is fixed by bundling the data originally sent via the 'sync' update, as part of the 'frame' update.

simonghales commented 3 years ago

Unfortunately I couldn't get the examples folder to work locally, so I haven't managed to verify this myself just yet. I should be able to do so tonight, but figured I'd make the PR request now in case somebody wanted to review it before then.

stockhuman commented 3 years ago

Hey Simon, thanks for this PR.

If you get your branch up to date with master and jump straight to the chain demo, you'll see this unfortunately breaks things with bodies[uuid] is undefined. I'd tried what you'd written in the discord and simply thought I was implementing it wrong when I saw the same result.

simonghales commented 3 years ago

I will take a look!

simonghales commented 3 years ago

@stockHuman the chain demo is working for me now

stockhuman commented 3 years ago

Awesome, thanks for the fix.