preface: I'm using Three-CSG to try and merge geometries in Three.js.
I'm getting thrown an error Uncaught ThreeBSP: Given geometry is unsupported
when passing in an instance of THREE.Mesh into the library's ThreeBSP
method.
Any ideas why i'm getting this error? I've provided a snippet of my code below, the object i'm passing into the library method evaluates to true
as an instanceof
THREE.Mesh
from inside my js file, so I'm clueless as to why the code is throwing the error. Any help would be greatly appreciated!
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
[...]
};
Thanks, James.
Not entirely sure about the root cause of the issue, but anyhow once I fixed this bug there were countless other errors, mostly due to idiosyncrasies between older versions used.
For anybody else looking to use this with ES2015 modules, I've just put together an NPM package for three-js-csg here with latest versions of both which solves these bugs:
https://github.com/James-Oldfield/three-js-csg
Which works!