O'Reilly logo

Learn ARCore - Fundamentals of Google ARCore by Micheal Lanham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required