ARnft-threejs icon indicating copy to clipboard operation
ARnft-threejs copied to clipboard

No remove function for added models.

Open Najaf93 opened this issue 4 years ago • 3 comments

Hi Guys, is there any way to remove added model? I can only find these functions:

  • add
  • addmodel
  • addImage
  • addVideo

can someone help me please figure it out, any help will be appreciable. Thank you

Najaf93 avatar Jul 24 '21 07:07 Najaf93

Hi @Najaf93 i moved this issue to ARnft-threejs because is more appropriate. To answer to your question: no, at the moment there aren't any function to remove the meshes or models. If i have time, i plan to add them in a near future.

kalwalt avatar Sep 16 '21 21:09 kalwalt

@Najaf93 and everybody has this issue, this should works for simple meshes: Assumed that you have your mesh:

let mat = new THREE.MeshLambertMaterial({ color: 0xff0000 });
let boxGeom = new THREE.BoxGeometry(1, 1, 1);
let cube = new THREE.Mesh(boxGeom, mat);

and you add it to the NFTaddTJS instance:

let nftAddTJS = new ARnftThreejs.NFTaddTJS(nft.uuid);
nftAddTJS.add(cube, 'pinball', false);

get the scene and remove the mesh:

const scene = sceneThreejs.getScene();
scene.remove(cube);

I have not tested the code so i can not say that it can works or not...

kalwalt avatar Nov 26 '21 22:11 kalwalt

I'm testing a new remove function on this branch https://github.com/webarkit/ARnft-threejs/tree/feature-remove, i will create a new example when i have time.

kalwalt avatar Jan 26 '22 17:01 kalwalt