I add an item to the viewer with the following function:
createText(params) {
const textGeometry = new TextGeometry(params.text,
Object.assign({}, {
font: new Font(FontJson),
params
}));
const geometry = new THREE.BufferGeometry;
geometry.fromGeometry(textGeometry);
const material = this.createColorMaterial(
params.color);
const text = new THREE.Mesh(
geometry, material);
text.scale.set(params.scale, params.scale, params.scale);
text.position.set(
params.position.x,
params.position.y,
10);
this.intersectMeshes.push(text);
this.viewer.impl.scene.add(text);
this.viewer.impl.sceneUpdated(true);
return text;
}
Later, I try to remove this item I have added with viewer.impl.scene.remove()
passing in the object I want to be removed. The problem with this is that it 1) does not remove the object 2) does not give me an error. I even add viewer.impl.sceneUpdated(true)
afterwards. Am I doing this wrong? Or is there a special way you have to do this with the viewer?