I tried so many things to get rid that Bounding Box Error when loading fbx splines. I can’t figure where can i compute that unnecesary? radius for the object bounding box.
This only happens with splines but not with other kind of geometry like obj or gltf.
let matLine;
async function loadBorders() {
/// LOAD SPLINES
let spline;
let splineGroup = new Group();
let countryGrp = new Group();
matLine = new LineMaterial({
color: new Color(0xffec78),
linewidth: 0, // in pixels
dashed: false,
opacity: 0
});
matLine.needsUpdate = true;
matLine.resolution.set(window.innerWidth, window.innerHeight); // resolution of the viewport
const bordersData = await load('./assets/models/Borders.fbx');
bordersData.children.forEach((item) => {
if (item.isLine) {
spline = setLine(item);
splineGroup.add(spline);
} else if (item.isGroup) {
item.children.forEach((line) => {
spline = setLine(line);
spline.position.set(item.position.x, item.position.y, item.position.z);
spline.rotation.set(item.rotation.x, item.rotation.y, item.rotation.z);
countryGrp.add(spline);
splineGroup.add(countryGrp);
});
}
});
splineGroup.position.set(splineGroup.position.x, splineGroup.position.y, splineGroup.position.z + -0.001);
splineGroup.scale.set(.01, .01, .01);
set.scene.add(splineGroup);
}
function setLine(line, col) {
let pos = line.position;
let rot = line.rotation;
const geoSpline = new WireframeGeometry2(line.geometry);
const spline = new Wireframe(geoSpline, matLine);
spline.position.set(pos.x, pos.y, pos.z);
spline.rotation.set(rot.x, rot.y, rot.z);
spline.computeLineDistances();
set.matLine.color = new Color("rgb(255, 255, 255)");
return spline;
}