pmndrs / use-cannon

👋💣 physics based hooks for @react-three/fiber

Home Page:https://cannon.pmnd.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deprecated function example

Kevw94 opened this issue · comments

commented

Hello, there is a problem in your example because of a deprecated method from Three.js : Three.Geometry()

So function bellow in example demo-ConvexPolyhedron.tsx doesn't work with Three.js r151 :

function toConvexProps(bufferGeometry: BufferGeometry): ConvexPolyhedronProps['args'] {
const geo = new Geometry().fromBufferGeometry(bufferGeometry)
// Merge duplicate vertices resulting from glTF export.
// Cannon assumes contiguous, closed meshes to work
geo.mergeVertices()
return [geo.vertices.map((v) => [v.x, v.y, v.z]), geo.faces.map((f) => [f.a, f.b, f.c]), []]
}

Thanks for all you are doing for developers :)