Exemplo n.º 1
0
 public static GeoWorldRoot GetInstance()
 {
     if (_instance == null)
     {
         _instance = new GeoWorldRoot();
     }
     return(_instance);
 }
Exemplo n.º 2
0
        void Awake()
        {
            ScapeLogging.Log(message: "OGeoAnchor::Awake " + this.gameObject.name);

            // this.gameObject.SetActive(false);

            GeoWorldRoot.GetInstance().RegisterGeoEvent(this.OriginEvent);

            WorldCoordinates = new Coordinates {
                longitude = Longitude, latitude = Latitude
            };
            WorldPos = GeoConversions.VectorFromCoordinates(WorldCoordinates);
        }
        void Awake()
        {
            if (!mCamera)
            {
                mCamera = Camera.main;
            }
            ScapeDirectionFix = Quaternion.AngleAxis(0.0f, Vector3.up);

            GeoWorldRoot.GetInstance().SetWorldOrigin(new Coordinates()
            {
                longitude = StartLongitude,
                latitude  = StartLatitude
            });
        }
        void SynchronizeARCamera(ScapeMeasurements scapeMeasurements)
        {
            Coordinates LocalCoordinates  = GeoConversions.CoordinatesFromVector(new Vector2(PositionAtScapeMeasurements.x, PositionAtScapeMeasurements.z));
            Coordinates OriginCoordinates = new Coordinates()
            {
                longitude = scapeMeasurements.coordinates.longitude - LocalCoordinates.longitude,
                latitude  = scapeMeasurements.coordinates.latitude - LocalCoordinates.latitude
            };

            ScapeLogging.Log(message: "SynchronizeARCamera() scapecoords = " + GeoConversions.CoordinatesToString(scapeMeasurements.coordinates));
            ScapeLogging.Log(message: "SynchronizeARCamera() localcoords = " + GeoConversions.CoordinatesToString(LocalCoordinates));
            ScapeLogging.Log(message: "SynchronizeARCamera() origincoords = " + GeoConversions.CoordinatesToString(OriginCoordinates));

            GeoWorldRoot.GetInstance().SetWorldOrigin(OriginCoordinates);

            Quaternion worldEulerRotation = new Quaternion((float)scapeMeasurements.orientation.x,
                                                           (float)scapeMeasurements.orientation.y,
                                                           (float)scapeMeasurements.orientation.z,
                                                           (float)scapeMeasurements.orientation.w);

            ScapeDirectionFix = worldEulerRotation * Quaternion.Inverse(RotationAtScapeMeasurements);
            ScapeLogging.Log(message: "SynchronizeARCamera() ScapeDirectionFix = " + ScapeDirectionFix);
        }