Is there a way to add meshes to Forge Viewer v6 using Type script?
I've tried various methods that worked with v4, but I'm encountering issues now.
private wallGeometry: THREE.BoxBufferGeometry;
drawWalls() {
this.wallGeometry = new THREE.BoxBufferGeometry(4000, 4000, 100, 1, 1, 1);
console.log('creating wall geometry');
this.wallGeometry = new THREE.BoxBufferGeometry(4000, 4000, 100, 1, 1, 1);
console.log('creating wall material');
let wallMaterial = new THREE.MeshPhongMaterial({ color: 0xff0000 });
console.log('register wall material');
this.viewer.impl.matman().addMaterial(
'dasher-material-vertex',
wallMaterial,
true);
console.log('create Overlay Scene');
this.viewer.impl.createOverlayScene(this._overlayScene, wallMaterial);
console.log('wall mesh');
this.wall = new THREE.Mesh(this.wallGeometry, wallMaterial);
this.wall.position.set(0, -1000, -2000);
console.log('add overlay to scene');
this.addToScene(this.wall);
}
private addToScene(obj: THREE.Object3D) {
this.viewer.impl.addOverlay(this._overlayScene, obj);
this.viewer.impl.invalidate(false, false, true);
}
After running the code above, I encountered the following error message:
THREE.Object3D.add: object not an instance of THREE.Object3D.
(additional details snippet here)proto: $n
Any suggestions on how to resolve this issue?
Edit: Here is a snapshot from my DevTools: https://i.sstatic.net/E0dsI.png