Burf2000
Burf2000

Reputation: 5193

Three.js : Upgrading to 0.137.5 causes TypeError: Cannot read properties of undefined (reading 'mergeBufferGeometries')

I am trying to upgrade my Three.js project from 0.126.1 to 0.137.5 however when I now run the project I get the following error.

Exception has occurred: TypeError: Cannot read properties of undefined (reading 'mergeBufferGeometries')

This is caused by the following method however because this did work I am not sure what to change

import { BufferGeometryUtils } from "three/examples/jsm/utils/BufferGeometryUtils.js";

extractAndMergeOuterMesh(gltf) {
      const geometries = [];
      gltf.traverse((child) => {
        if (child.isMesh && child.name == "polySurface21") {
          geometries.push(child.geometry);
        }
      });

Upvotes: 1

Views: 1952

Answers (1)

Burf2000
Burf2000

Reputation: 5193

As mentioned in the comments by prisoner849, this was caused due to Three.js changing how it imported BufferGeometryUtils.

The key was the '*"

import * as BufferGeometryUtils from "three/examples/jsm/utils/BufferGeometryUtils.js";

Upvotes: 2

Related Questions