Closed Zaniyar closed 2 years ago
You can force it to reappear once it hides:
<script>
document.addEventListener("DOMContentLoaded", function () {
let target = document.querySelector('a-entity[mindar-image-target]'); //Get ImageTarget
let delay = 1; // Milliseconds of delay to reactivate
//target lost event
target.addEventListener("targetLost", event => {
console.log("target lost");
//waiting to reactivate
setTimeout(function () {
target.object3D.visible = true; //making it visible
}, delay);
})
});
</script>
thx. worked. despite of the thread is closed, but it is a related question: why is target.object3D.position, target.position, camera postion or rotation always (0,0,0)? How could I move the object3D in front of the camera? camera.lookAt(target.object3D.position) is also not working. I want to get the position of the camera (phone?) and the position in the world of the marker.
How can I force to make the object visible even on markerlost event? I would like to be able show the scene when tracking is lost.