title: Using tick function in a-frame to update object position based on camera position
body: <p>I'm using A-Frame and want an object to move along with the camera. To do this, I put together a component that updates the object's position based on the camera position:</p>
  
  <pre><code>      AFRAME.registerComponent('follow', {
      schema: {
        distance: {type: 'vec3'},
        target: {type: 'selector'}
      },
  
      tick: function() {
        const targetItem = this.data.target;
        const relativePosition = this.data.distance
  
        var tempPos = targetItem.getAttribute("position").split(" ").map(Number);
  
        targetPos = new THREE.Vector3(relativePosition.x + tempPos[0], relativePosition.y + tempPos[1], relativePosition.z + tempPos[2]);
  
        this.el.setAttribute('position', targetPos)
      }
    });
  </code></pre>
  
  <p>This works fine when I use <code>init</code> instead of <code>tick</code> but since it's an init function it only updates it once at the start of the scene. For some reason, when I use <code>tick</code> everything breaks. Am I using it wrong? Should I do something different to continually update it's position?</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Edit:</strong> I should mention the goal is to have something follow around, but <em>not</em> be fixed to your view. Think Navi from Ocarina of Time.</p>