pmndrs / use-cannon

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

Three >=0.125.0 does not export Geometry #152

Closed PiotrGamorski closed 3 years ago

PiotrGamorski commented 3 years ago

Importing Physics from "@react-three/cannon" or equivalently "use-cannon" I have the following issue:

Failed to compile.

./node_modules/@react-three/cannon/dist/index-cd273dfe.js Attempted import error: 'Geometry' is not exported from 'three' (imported as 'm'). Error from chokidar (C:): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'

By the way, I'm following a tutorial step by step and there everything seems to be ok. Did you have the same problem?

stockhuman commented 3 years ago

Hi Piotr,

Yeah, I'll be pushing a fix for this; unless you or someone else beats me to it. This error comes from using the three@>=0.125.0, which introduced a breaking change: the removal of Geometry and associated classes.

use-cannon includes niceties for Convex Polyhedron & Trimesh, so you can just pass them Geometries, but that won't work with later versions of Three.

To get around this, you can downgrade to r124 or lower. Thanks :)