示例#1
0
        public void CreateRoutePoints()
        {
            var distance = Scholar.Distance(deviceLocation, TargetLocation, 'm');
            var bearing  = Scholar.BearingTo(deviceLocation, TargetLocation);
            // TODO: 179 ?
            var bearingRadians = Scholar.Deg2Rad(bearing) + 179;

            // Rotate POI's
            var xRot = -Math.Sin(bearingRadians) * (distance - 0) + 0;
            var zRot = +Math.Cos(bearingRadians) * (distance - 0) + 0;

            worldRouteRenderer.SetRoute(new Vector3(0, 0, 0), new Vector3((float)-xRot, 0, (float)zRot));
        }
示例#2
0
        public void UpdateWorldPlaces()
        {
            knownPlaces.ForEach(place =>
            {
                //distance + bearing calculation
                var distance   = Scholar.Distance(deviceLocation, place.Location, 'm');
                var bearing    = Scholar.BearingTo(deviceLocation, place.Location);
                place.Distance = (float)distance;
                place.Bearing  = (float)bearing;
                // TODO: 179 ?
                var bearingRadians = Scholar.Deg2Rad(bearing) + 179;

                // Rotate POI's
                var xRot = -Math.Sin(bearingRadians) * (distance - 0) + 0;
                var zRot = +Math.Cos(bearingRadians) * (distance - 0) + 0;
                place.transform.localPosition = new Vector3((float)-xRot, 0, (float)zRot);
            });
            knownPlaces.Sort((a, b) => a.Distance.CompareTo(b.Distance));
            knownPlaces.ForEachWithIndex((place, index) =>
            {
                SetPlaceSettingsAt(index);
            });
        }