pmndrs / use-cannon

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

add bodies failsafe #408

Closed alex-shortt closed 2 years ago

alex-shortt commented 2 years ago

add check to make sure bodies exist, and if not, remove the subscription

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
use-cannon ✅ Ready (Inspect) Visit Preview Sep 19, 2022 at 8:50AM (UTC)
alex-shortt commented 2 years ago

updated the code .. i'm going to throw the fix for removeBodies in a separate PR since i'm not 100% sure of the syntax and getting this is asap would be ideal

bjornstar commented 2 years ago

Sorry I've been busy for a bit. Taking a look at this now and I'd rather fix the root cause. Sure, you won't get an exception anymore but your physics body will stop moving. Could you provide an example of this failing somewhere?

alex-shortt commented 2 years ago

if you want to fix the root cause check #411 . i can fix the pr to not include the failsafe if you'd like

isaac-mason commented 2 years ago

I think fixing the root cause is best. With that, we might not need the failsafe?

alex-shortt commented 2 years ago

going to fix root cause instead of failsafe, opened #412