Visualizing tracked motion

Now that we understand how to track motion and have a service in place, let's see how we can put this service to use and visualize the tracked data in our AR app. Open up the spawn-at-surface.html page in a text editor and follow the given steps:

  1. Find that last line of code we added in the last exercise and delete it:
firebase.database().ref('pose/' + 1).set({x: 12,y: 1,z : 0});  //delete me
  1. Replace that line with the following code:
var idx = 1;setInterval(function(){ idx = idx + 1; if(camera){  camera.updateProjectionMatrix();  var pos = camera.position;  var rot = camera.rotation;  firebase.database().ref('pose/' + idx).set({x: pos.x,y: pos.y,z : pos.z, roll: rot._z, pitch: rot._x, yaw: rot._y }); } }, 1000); ...

Get Learn ARCore - Fundamentals of Google ARCore now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.