2

前言:我正在使用Three-CSG来尝试合并 Three.js 中的几何图形。

Uncaught ThreeBSP: Given geometry is unsupported将 THREE.Mesh 的实例传递到库的ThreeBSP方法中时出现错误。

任何想法为什么我会收到此错误?我在下面提供了我的代码片段,我传递给库方法的对象评估trueinstanceof THREE.Mesh来自我的 js 文件中的一个,所以我对代码抛出错误的原因一无所知。任何帮助将不胜感激!

import THREE from 'three';
import CSG from 'three-csg';

[...]

export const meshFactory = () => {
  const cone = {};
  cone.geometry = new THREE.CylinderGeometry(5, 100, 100, 32);
  cone.mesh = new THREE.Mesh(cone.geometry);

  console.log(cone.mesh instanceof THREE.Mesh); // prints true

  const coneBSP = new CSG(cone.mesh); // error thrown here as it doesn't appear to be an instance of THREE.Mesh or other valid cases

[...]
};

链接到控制台错误

谢谢,詹姆斯。

4

1 回答 1

0

不完全确定问题的根本原因,但无论如何,一旦我修复了这个错误,就会出现无数其他错误,主要是由于使用的旧版本之间的特质。

对于其他希望将其与 ES2015 模块一起使用的人,我刚刚在这里为三个 js-csg组合了一个 NPM 包,其中包含解决这些错误的最新版本:

https://github.com/James-Oldfield/three-js-csg

哪个有效!

于 2015-12-15T16:17:14.423 回答