THREE.Geometry will be removed from core with r125

Probably related to this, but can anyone point me in the right direction in how to achieve Geometry.mergeVertices() for the BufferGeometry?

I am doing it using BufferGeometryUtils.mergeVertices() but the result is very different.

I have

const hull = new ConvexGeometry(vertices) // this is a BufferGeometry

console.log(hull.attributes.position.count) // --> 558

// Geometry mergeVertices
const hullGeometry = new Geometry().fromBufferGeometry(hull)
hullGeometry.mergeVertices()
console.log(hullGeometry.vertices.length) // --> 95

// BufferGeometry mergeVertices
const hullBufferGeometry = BufferGeometryUtils.mergeVertices(hull)
console.log(hullBufferGeometry.attributes.position.count) // --> 556 but it should be 95

jsfiddle here

I am doing this for a physics engine, and the result that works is the one with 95 vertices.

1 Like