コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        wifiMarkers = new List <WifiMarker>();

        if (dataStore.markerData == null)
        {
            dataStore.markerData = new List <WifiMarkerData>();
        }
        // todo add manually here to set up scenario.

        if (spawnMode == WFSpawnMode.Auto)
        {
            foreach (var loadedMarker in dataStore.markerData)
            {
                //var latLongAlt = Api.Instance.SpacesApi.WorldToGeographicPoint(player.transform.position);

                LatLongAltitude latLongAlt = new LatLongAltitude(loadedMarker.Latitude, loadedMarker.Longitude, loadedMarker.Altitude);

                var wifi = Instantiate(spawnWifiObj) as GameObject;
                wifi.GetComponent <GeographicTransform>().SetPosition(latLongAlt.GetLatLong());
                wifi.GetComponent <GeographicTransform>().SetElevation(latLongAlt.GetAltitude());

                var marker = wifi.GetComponent <WifiMarker>();
                marker.markerData.Latitude      = (float)latLongAlt.GetLatitude();
                marker.markerData.Longitude     = (float)latLongAlt.GetLongitude();
                marker.markerData.Altitude      = (float)latLongAlt.GetAltitude();
                marker.markerData.name          = loadedMarker.name;
                marker.markerData.strengthLevel = loadedMarker.strengthLevel;
                marker.EnabledWifiSignaler();
                marker.SetTextName();

                wifiMarkers.Add(marker);
            }
        }
    }
コード例 #2
0
    protected virtual void Move(Vector2 axisDirection)
    {
        if (isHeightOnly)
        {
            //Debug.Log(axisDirection);

            Vector2 updatedPosition = axisDirection * currentSpeed * Time.deltaTime * EarthLatLongMultiplier;
            var     alt             = latLongAlt.GetAltitude();
            alt += updatedPosition.y;
            //Debug.Log(axisDirection);

            latLongAlt.SetAltitude(alt);
        }
        else
        {
            Vector2 updatedPosition = axisDirection * currentSpeed * Time.deltaTime * EarthLatLongMultiplier;

            var lng = latLongAlt.GetLongitude();
            lng += updatedPosition.x;

            var lat = latLongAlt.GetLatitude();
            lat += updatedPosition.y;

            latLongAlt.SetLongitude(lng);
            latLongAlt.SetLatitude(lat);
        }

        Api.Instance.SetOriginPoint(latLongAlt);

        //if (CanMove(bodyPhysics, controlledGameObject.transform.position, finalPosition))
        //{
        //    controlledGameObject.transform.position = finalPosition;
        //}
    }
コード例 #3
0
    private void SetPosition()
    {
        latLongAlt.SetLatitude(startLatLongAlt.GetLatitude() + (double)latitude);
        latLongAlt.SetLongitude(startLatLongAlt.GetLongitude() + (double)longitude);
        latLongAlt.SetAltitude(startLatLongAlt.GetAltitude() + (double)altitudeInMetres);

        Api.Instance.SetOriginPoint(latLongAlt);
    }
コード例 #4
0
ファイル: CameraApi.cs プロジェクト: huayyang/HackdayDemo
        private static void GetTiltHeadingAndDistanceFromCameraAndTargetPosition(LatLong interestPoint, LatLongAltitude cameraPosition, out double tiltDegrees, out double headingDegrees, out double distance)
        {
            double distanceAlongGround = LatLong.EstimateGreatCircleDistance(interestPoint, cameraPosition.GetLatLong());
            double cameraAltitude      = cameraPosition.GetAltitude();

            distance       = Math.Sqrt(distanceAlongGround * distanceAlongGround + cameraAltitude * cameraAltitude);
            headingDegrees = cameraPosition.BearingTo(interestPoint);
            tiltDegrees    = MathsHelpers.Rad2Deg(Math.PI * 0.5 - Math.Atan2(cameraAltitude, distanceAlongGround));
        }
コード例 #5
0
ファイル: InteropTypes.cs プロジェクト: ryanfic/crowd-control
 public static LatLongAltitudeInterop FromLatLongAltitude(LatLongAltitude lla)
 {
     return(new LatLongAltitudeInterop
     {
         LatitudeDegrees = lla.GetLatitude(),
         LongitudeDegrees = lla.GetLongitude(),
         Altitude = lla.GetAltitude()
     });
 }
コード例 #6
0
    private void Start()
    {
        var ct = Controller.HoverTracker(this);
        //ct.onTriggerDown += OnTriggerDown;
        var positionOpt = new Wrld.Space.Positioners.PositionerOptions();

        //Api.Instance.PositionerApi.CreatePositioner(positionOpt);

        startLatLongAlt = Api.Instance.SpacesApi.WorldToGeographicPoint(new Vector3(0, 100, 0));

        Debug.Log(startLatLongAlt.GetLatitude());
        Debug.Log(startLatLongAlt.GetLongitude());
        Debug.Log(startLatLongAlt.GetAltitude());


        latitude         = 0;
        longitude        = 0;
        altitudeInMetres = 0;

        latLongAlt = startLatLongAlt;

        dialogSetLat.Set("Slider", transform.rotation.eulerAngles.y, onChange: value =>
        {
            latitude = value / 9000f;
            SetPosition();
        });

        dialogSetLong.Set("Slider", transform.rotation.eulerAngles.y, onChange: value =>
        {
            longitude = value / 9000f;
            SetPosition();
        });

        dialogSetAlt.Set("Slider", transform.rotation.eulerAngles.y, onChange: value =>
        {
            altitudeInMetres = value;

            SetPosition();
        });
    }
コード例 #7
0
        public void HighlightBuildingAtLocation(LatLongAltitude location, Material material, HighlightReceivedCallback callback)
        {
            int highlightRequestId = m_nextHighlightRequestId;
            HighlightRequest request;

            request.material = material;
            request.callback = callback;
            HighlightRequests.Add(highlightRequestId, request);
            NativeHighlightBuildingAtLocation(NativePluginRunner.API, location.GetLatitude(), location.GetLongitude(), location.GetAltitude(), OnHighlightReceived, highlightRequestId);
            m_nextHighlightRequestId += 1;
        }
コード例 #8
0
        public void GetBuildingAtLocation(LatLongAltitude location, BuildingReceivedCallback callback)
        {
            int             buildingRequestId = m_nextBuildingRequestId;
            BuildingRequest request;

            request.callback = callback;
            BuildingRequests.Add(buildingRequestId, request);
            NativeGetBuildingAtLocation(NativePluginRunner.API, location.GetLatitude(), location.GetLongitude(), location.GetAltitude(), OnBuildingReceived, buildingRequestId);
            m_nextBuildingRequestId += 1;
        }