pmndrs / use-cannon

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

Basic example exhibits strange restitution (?) behaviour #235

Closed tommhuth closed 2 years ago

tommhuth commented 3 years ago

I tried setting up a very basic example with a simple sphere falling on to a static box, but I'm getting some unexpected wonkyness: regardless of what I set restitution to, the sphere will bouncy like crazy, even beyond what i would expect restitution=1 to produce (https://codesandbox.io/s/restitution-yikqh). Am I missing something obvious again?

drcmda commented 3 years ago

this seems wrong: let [ref] = useSphere(() => ({ mass: 5, args: [1], position: [0, 4, 0] }))

i don't think typescript would let you compile it: interface SphereProps extends BodyProps {} // radius

args: 1 works ok, but i start to think we should make it an array just to remove the ambiguity. this has also caused problems with the debugger recently. in r3f i made all args use array notation for the same reason, i didn't want people to think back and forth. but for some reason use-cannon does it. :-S

tommhuth commented 3 years ago

oh you're right, that's definitely unexpected. would be great if args always was an array, for consistency.