pmndrs / use-cannon

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

Add deps to hooks: useBox, usePlane e.t.c. #119

Closed MaxmaxmaximusAWS closed 3 years ago

MaxmaxmaximusAWS commented 3 years ago

now i have this:

const [ref, api] = useBox(() => ({
    mass: 1,
    args: [4, 4, 4],
    isKinematic: true,
}))

but want to this:

const [size, setSize] = useState([4, 4, 4])

const [ref, api] = useBox(() => ({
    mass: 1,
    args: size,
    isKinematic: true,
}), [size])