Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        waypointController = GameObject.Find("WaypointController");

        if (waypointController != null && waypointController.GetComponent <WayPointController>() != null &&
            waypointController.GetComponent <WayPointController>().GetStartWaypoint() != null &&
            waypointController.GetComponent <WayPointController>().GetRoute2DPoints() != null)
        {
            Debug.Log("Camera Movement Start WaypointController found.");
            //waypoint3DPoints = waypointController.GetComponent<WayPointController>().GetRoute3DPoints();
            //Debug.Log(waypoint3DPoints[0]);
            //Camera.main.transform.position = waypoint3DPoints[0];
            //maxIndex = waypoint3DPoints.Count;
            //Debug.Log("maxindex: " + maxIndex);
            index = 0;

            waypoint2DPoints = waypointController.GetComponent <WayPointController>().GetRoute2DPoints();
            var startLocation = LatLong.FromDegrees(waypoint2DPoints[0].x, waypoint2DPoints[0].y);
            //var startLocation = LatLong.FromECEF(waypoint3DPoints[0]);
            //Debug.Log("Camera start point: " + waypoint3DPoints[0]);
            maxIndex = waypoint2DPoints.Count;

            Api.Instance.CameraApi.MoveTo(startLocation, distanceFromInterest: 800, headingDegrees: 0, tiltDegrees: 0);
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        Debug.Log("Camera Movement Update.");
        if (Input.GetKey("a"))
        {
            if (
                //waypoint3DPoints != null && waypoint3DPoints.Count > 0
                waypoint2DPoints != null && waypoint2DPoints.Count > 0
                )
            {
                Debug.Log("Camera Movement Update waypoint2DPoints found.");

                if (index < maxIndex)
                {
                    index++;
                    //Vector3 viewportPoint = Camera.main.ScreenToViewportPoint(waypoint3DPoints[index]);
                    //Debug.Log("Index (" + index + " / " + maxIndex + ") 3D Point: " + waypoint3DPoints[index]);

                    // Camera.main.transform.position = Vector3.MoveTowards(Camera.main.transform.position, viewportPoint, 5f);
                    Debug.Log("Index (" + index + " / " + maxIndex + ") 2D Point: " + waypoint2DPoints[index]);

                    var destLocation = LatLong.FromDegrees(waypoint2DPoints[index].x, waypoint2DPoints[index].y);
                    // var destLocation = LatLong.FromECEF(waypoint3DPoints[index]);
                    Debug.Log("Camera destination point: " + destLocation);

                    Api.Instance.CameraApi.AnimateTo(destLocation, distanceFromInterest: 500, transitionDuration: 5);
                }
            }
        }
    }
 private void OnEnable()
 {
     // cache a 2000 meter radius around this point
     Api.Instance.PrecacheApi.Precache(LatLong.FromDegrees(37.7952, -122.4028), 2000.0, (_result) =>
     {
         Debug.LogFormat("Precaching {0}", _result.Succeeded ? "complete" : "failed");
     });
 }
    IEnumerator Example()
    {
        var startLocation = LatLong.FromDegrees(37.7858, -122.401);
        Api.Instance.CameraApi.MoveTo(startLocation, distanceFromInterest: 800, headingDegrees: 0, tiltDegrees: 50);

        yield return new WaitForSeconds(4.0f);

        var destLocation = LatLong.FromDegrees(37.7952, -122.4028);
        Api.Instance.CameraApi.MoveTo(destLocation, distanceFromInterest: 500);
    }
Beispiel #5
0
    IEnumerator Example()
    {
        var startLocation = LatLong.FromDegrees(37.7858, -122.401);

        Api.Instance.CameraApi.MoveTo(startLocation, distanceFromInterest: 800, headingDegrees: 0, tiltDegrees: 50);

        yield return(new WaitForSeconds(4.0f));

        var endLocation = LatLong.FromDegrees(37.7858, -122.401);

        Api.Instance.CameraApi.AnimateTo(endLocation, headingDegrees: 45, tiltDegrees: 20);
    }
    IEnumerator Example()
    {
        var startLocation = LatLong.FromDegrees(37.7858, -122.401);

        Api.Instance.CameraApi.MoveTo(startLocation, distanceFromInterest: 800, headingDegrees: 0, tiltDegrees: 50);

        yield return(new WaitForSeconds(4.0f));

        var destLocation = LatLong.FromDegrees(37.802, -122.4058);

        Api.Instance.CameraApi.AnimateTo(destLocation, distanceFromInterest: 500, headingDegrees: 270, transitionDuration: 5, jumpIfFarAway: false);
    }
Beispiel #7
0
    IEnumerator Example()
    {
        var startLocation = LatLong.FromDegrees(53.495, -113.5210);

        Api.Instance.CameraApi.MoveTo(startLocation, distanceFromInterest: 800, headingDegrees: 0, tiltDegrees: 50);

        yield return(new WaitForSeconds(4.0f));

        var destLocation = LatLong.FromDegrees(53.515, -113.5276);

        Api.Instance.CameraApi.MoveTo(destLocation, distanceFromInterest: 500);
    }
    void OnBuildingSelected(bool success, Building building)
    {
        if (success)
        {
            var boxLocation = LatLong.FromDegrees(building.Centroid.GetLatitude(), building.Centroid.GetLongitude());
            var boxAnchor   = Instantiate(boxPrefab) as GameObject;
            boxAnchor.GetComponent <GeographicTransform>().SetPosition(boxLocation);

            var box = boxAnchor.transform.GetChild(0);
            box.localPosition = new Vector3(0.0f, (float)building.TopAltitude, 0.0f);
            Destroy(boxAnchor, 2.0f);
        }
    }
    IEnumerator Example()
    {
        Api.Instance.CameraApi.RegisterShouldConsumeInputDelegate(ShouldConsumeCameraInput);

        var startLocation = LatLong.FromDegrees(37.7858, -122.401);

        Api.Instance.CameraApi.MoveTo(startLocation, distanceFromInterest: 800, headingDegrees: 0, tiltDegrees: 50);

        yield return(new WaitForSeconds(4.0f));

        var destLocation = LatLong.FromDegrees(37.7952, -122.4028);

        Api.Instance.CameraApi.MoveTo(destLocation, distanceFromInterest: 500);
    }
Beispiel #10
0
    private void OnEnable()
    {
        // Start precaching resources in a 2000 meter radius around this point
        PrecacheOperation precacheOperation = Api.Instance.PrecacheApi.Precache(
            LatLong.FromDegrees(37.7952, -122.4028),
            2000.0,
            (_result) =>
        {
            Debug.LogFormat("Precaching {0}", _result.Succeeded ? "complete" : "cancelled");
        });

        // cancel the precache operation
        precacheOperation.Cancel();
    }
        internal static void OnBuildingReceived(bool buildingReceived, BuildingInterop building, int buildingRequestId)
        {
            var request = BuildingRequests[buildingRequestId];

            Building result;

            result.BuildingId   = Marshal.PtrToStringAnsi(building.StringIdPtr);
            result.BaseAltitude = building.BaseAltitude;
            result.TopAltitude  = building.TopAltitude;
            result.Centroid     = LatLong.FromDegrees(building.CentroidLatitude, building.CentroidLongitude);

            BuildingRequests.Remove(buildingRequestId);

            request.callback(buildingReceived, result);
        }
    void MakeBox(LatLong latLong)
    {
        double altitude;
        var    success = Api.Instance.BuildingsApi.TryGetAltitudeAtLocation(latLong, out altitude);

        if (success)
        {
            var boxLocation = LatLong.FromDegrees(latLong.GetLatitude(), latLong.GetLongitude());
            var boxAnchor   = Instantiate(boxPrefab) as GameObject;
            boxAnchor.GetComponent <GeographicTransform>().SetPosition(boxLocation);

            var box = boxAnchor.transform.GetChild(0);
            box.localPosition = new Vector3(0.0f, (float)altitude, 0.0f);
            Destroy(boxAnchor, 2.0f);
        }
    }
Beispiel #13
0
    public void Initialzie(CityPopularityDBObject cityPopularity, Dictionary <string, TrackMetadataDBObject> trackMetadata)
    {
        latitude        = cityPopularity.latitude;
        longitude       = cityPopularity.longitude;
        coordinateFrame = GetComponentInChildren <GeographicTransform>();
        geoPos          = LatLong.FromDegrees(latitude, longitude);
        coordinateFrame.SetPosition(geoPos);

        trackPanels = new List <GameObject>();

        canvas = GetComponentInChildren <Canvas>();
        canvas.GetComponentInChildren <Text>().text = cityPopularity.cityName;

        if (!trackMetadata.ContainsKey(cityPopularity.trackList[0]))
        {
            return;
        }

        InitializeTrackPanelHeader(trackMetadata[cityPopularity.trackList[0]]);


        for (int i = 1; i < cityPopularity.trackList.Length; i++)
        {
            string trackAsin = cityPopularity.trackList[i];
            if (!trackMetadata.ContainsKey(trackAsin))
            {
                continue;
            }

            GameObject trackPanel = GameObject.Instantiate(trackPanelPrefab);
            trackPanel.transform.parent = canvas.transform;

            Vector3 pos = new Vector3(0.0f, initialYOffset + i * yOffsetPadding, 0.0f);
            trackPanel.transform.position = pos;

            InitializeTrackPanel(trackPanel, trackMetadata[trackAsin]);
            trackPanels.Add(trackPanel);
        }

        HideOrShowTrackPanels();

        Api.Instance.GeographicApi.RegisterGeographicTransform(coordinateFrame);
    }
Beispiel #14
0
    void PlayTransitionNum(int num)
    {
        var api = Api.Instance;

        switch (num)
        {
        case 0:
            var transamericaPyramidSanFrancisco = LatLong.FromDegrees(37.7951572, -122.4028915);
            api.CameraApi.AnimateTo(transamericaPyramidSanFrancisco, distanceFromInterest: 1500, headingDegrees: 90, pitchDegrees: 45);
            break;

        case 1:
            var ferryBuildingSanfrancisco = LatLong.FromDegrees(37.7955683, -122.3935391);
            api.CameraApi.AnimateTo(ferryBuildingSanfrancisco, headingDegrees: 270, pitchDegrees: 0);
            break;

        case 2:
            var rinconParkSanFrancisco = LatLong.FromDegrees(37.791542, -122.3902725);
            var cameraPosition         = LatLongAltitude.FromDegrees(37.791542 + 0.005, -122.3902725, 500.0);
            api.CameraApi.AnimateTo(rinconParkSanFrancisco, cameraPosition);
            break;
        }
    }
Beispiel #15
0
 public void SetLocation(double latitudeDegrees, double longitudeDegrees)
 {
     m_position = LatLong.FromDegrees(latitudeDegrees, longitudeDegrees);
     SetPosition(m_position);
 }
    void OnEnable()
    {
        var cameraLocation = LatLong.FromDegrees(37.795641, -122.404173);

        Api.Instance.CameraApi.MoveTo(cameraLocation, distanceFromInterest: 400, headingDegrees: 0, tiltDegrees: 45);
    }
Beispiel #17
0
        public void SetCameraPosition()
        {
            var api = Api.Instance;

            api.CameraApi.MoveTo(LatLong.FromDegrees(InterestPointLatitudeDegrees, InterestPointLongitudeDegrees), DistanceFromInterestPoint);
        }
Beispiel #18
0
 public void OnCityNameClicked()
 {
     Api.Instance.CameraApi.MoveTo(LatLong.FromDegrees(latitude, longitude), 3000.0f);
 }