Пример #1
0
    private void Update()
    {
        var position = _referenceCamera.transform.position;

        position.y = _map.QueryElevationInMetersAt(_map.CenterLatitudeLongitude) + _cameraOffset;
        _referenceCamera.transform.position = position;
    }
Пример #2
0
    public Vector3 AdjustPosForDepth(Vector3 unadjustedPos)
    {
        AbstractMap map = MapStore.Instance.map;
        float       currentElevMeter = map.QueryElevationInMetersAt(this.latLon);
        float       currentElevUnity = map.QueryElevationInUnityUnitsAt(this.latLon) * map.transform.localScale.y;

        currentElevMeter = currentElevMeter == 0 ? 0.001f : currentElevMeter; // Cheat if necessary
        float ratio = currentElevUnity / currentElevMeter;
        // Convert kilometers to meters
        float depthInMeters = -this.depth * 1000;
        float adjUnityUnits = ratio * depthInMeters;
        float adjElevUnity  = unadjustedPos.y + adjUnityUnits - currentElevUnity;

        return(new Vector3(unadjustedPos.x, adjElevUnity, unadjustedPos.z));
    }