Hello,
So I have this simple AR project that just load and place a flower in the middle of the scene, I want to “grab” it and move it around. I want to attach it to the camera to move it and release it using this code:
let flipflop = true;
session.addEventListener("select", (event) => {
if (flower) {
if(flipflop){
camera.attach(flower);
flipflop = !flipflop;
}else{
camera.remove(flower);
flower.matrixWorld.decompose( flower.position, flower.quaternion, flower.scale );
scene.add(flower);
flipflop = !flipflop;
}
}
});
The problem is when I attach it to the camera the flower disappear, yet when I click again it will detach normally and reappear in the scene! (Knowing that before attaching, I can see the flower!) any idea why the flower is disappearing when attached to the camera?
Thanks.