Three.js : Upgrading to 0.137.5 causes TypeError: Cannot read properties of undefined (reading 'mergeBufferGeometries')
Three.js : Upgrading to 0.137.5 causes TypeError: Cannot read properties of undefined (reading 'mergeBufferGeometries')
我正在尝试将我的 Three.js 项目从 0.126.1 升级到 0.137.5,但是当我现在 运行 该项目时,我收到以下错误。
Exception has occurred: TypeError: Cannot read properties of undefined
(reading 'mergeBufferGeometries')
这是由以下方法引起的,但是因为它确实有效,所以我不确定要更改什么
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);
}
});
正如 prisoner849 在评论中提到的,这是由于 Three.js 改变了导入 BufferGeometryUtils 的方式造成的。
关键是“*”
import * as BufferGeometryUtils from "three/examples/jsm/utils/BufferGeometryUtils.js";
我正在尝试将我的 Three.js 项目从 0.126.1 升级到 0.137.5,但是当我现在 运行 该项目时,我收到以下错误。
Exception has occurred: TypeError: Cannot read properties of undefined (reading 'mergeBufferGeometries')
这是由以下方法引起的,但是因为它确实有效,所以我不确定要更改什么
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);
}
});
正如 prisoner849 在评论中提到的,这是由于 Three.js 改变了导入 BufferGeometryUtils 的方式造成的。
关键是“*”
import * as BufferGeometryUtils from "three/examples/jsm/utils/BufferGeometryUtils.js";