webarkit / ARnft-threejs

A rendering package for https://github.com/webarkit/ARnft
GNU General Public License v3.0
23 stars 8 forks source link

No remove function for added models. #13

Open Najaf93 opened 3 years ago

Najaf93 commented 3 years ago

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

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

kalwalt commented 3 years ago

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 commented 2 years ago

@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 commented 2 years ago

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.