pmndrs / use-cannon

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

Expose wakeUp() in body api #137

Closed andreivips closed 3 years ago

andreivips commented 3 years ago

Hi, and thanks for great libs !

Bodies falls asleep ( when <Physics allowSleep={true}> ), but after, won't move with applyImpulse/Force, wakeUp() needs to exposed: https://github.com/pmndrs/cannon-es/blob/eb222d1169195dd0b570d1aaa749a814bacd747a/src/objects/Body.ts#L261

Also, cannons world.hasActiveBodies is used to invalidateFrameloop in react-three-fiber: https://github.com/pmndrs/use-cannon/blob/0243fb366f7a1a5343cfb9930fe274f5fee9a6d7/src/Provider.tsx#L151 and can be exposed in useCannon's Provider (<Physics...>) to track bodies state.

Maybe with an iteration few more methods/props would be straight available.

johnmarinelli commented 3 years ago

i also ran into this issue, would be nice to have this feature

andreivips commented 3 years ago

Should be closed by https://github.com/pmndrs/cannon-es/pull/61