title: How to find marker position in AFrame using JavaScript?
body: <p>I'm using a camera and barcode markers. In order for my cannon to shoot I need to spawn a sphere when a clicked. I tried to get the marker position by using <em>.getAttribute('position')</em> but I'm getting disappointing results e.g. null and [object, object]. Is there a real way to to access the coordinates of a marker in AFrame? So far it creates a sphere but right in the camera because its unable to find the location of the marker.</p>
  <h1>Javascript</h1>
  <pre><code>var sceneEl = document.querySelector('a-scene'); //select scene
      var markerEl = document.querySelector('#cannonMarker');
    // trigger event when button is pressed.
    document.addEventListener(&quot;click&quot;, function (e) {
      
      var pos = markerEl.getAttribute('position');
      var Sphere = document.createElement('a-sphere');
      
      
      
      Sphere.setAttribute('dynamic-body', {
      shape: 'sphere',
      mass: 4
      });
      
      Sphere.setAttribute('position', pos);
      
      
      
      
      sceneEl.appendChild(Sphere);
      
      console.log('Sphere coordinates:' + pos);
      
      
      
   });
  </code></pre>