hiukim / mind-ar-js

Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js
MIT License
2.21k stars 412 forks source link

Render the rest of the A-Frame Scene outside the MindAR Target #537

Open marco6ocram opened 2 months ago

marco6ocram commented 2 months ago

TLDR: Is there a way to render the rest of the scene outside of the MindAR target?

I know that is stated in the documentation that:

Remember this. The AR engine only does ONE thing! - It updates the visibility and positions of a-entity

But I think that being able to explore the rest of the scene using the Magic Window while interacting with the marker's positions is something that enhances a lot of augmented reality experiences.

In AR.js, this is currently possible, but the positions of the objects anchored to the marker get an offset. There are things that can be worked around, but the thing stopping me from using AR.js is that I don't know how to pause the AR.js engine in order to use the camera for other things, as it is possible in MindAR.

dariocavada commented 2 weeks ago

I tried placing objects outside the MindAR target, but they are automatically hidden. Here's the behavior I would like to achieve:

  1. Start scanning.
  2. When the image target is found, capture the anchor.
  3. Keep the objects visible (using only sensors like the gyroscope, etc.) even when the target is lost.

I tried using onTargetFound to copy world coordinates and assign them to another entity external to the image entity, but it didn't work.

onTargetFound: function () {
    console.log('Target found');
},
onTargetLost: function () {
    console.log('Target lost');
},

I noticed that in the A-Frame "Hello World" example (https://aframe.io/examples/showcase/helloworld/), the sensors are working quite well.