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

Fixing the altitude issue

You may notice an issue if you live above 500 meters above sea level. This issue happens because our AR camera is fixed at 500 meters altitude. The problem is that we have our AR camera at a fixed height; we now need to adjust that based on the camera's altitude. Open back up the editor and complete the following:

  1. Create a new C# script and replace the code with the following:
using System.Collections;using System.Collections.Generic;using UnityEngine;namespace Packt.HoloCore{  public class SceneCameraMover : MonoBehaviour  {    void Awake()    {      var altitude = SceneController.Instance.position.GetAltitude();      transform.position = new Vector3(0f, (float)altitude, 0f);    }  }}
  1. This script creates a new class called SceneCameraMover ...

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