Created
June 21, 2017 19:04
-
-
Save brnkhy/dcff0ba425303a69b995296a90dea4fe to your computer and use it in GitHub Desktop.
AddPoi.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Mapbox.Unity.Map; | |
using Mapbox.Unity.Utilities; | |
using Mapbox.Utils; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class AddPoi : MonoBehaviour | |
{ | |
public AbstractMap Map; | |
public List<string> Coordinates; | |
void Start() | |
{ | |
Map.OnInitialized += () => | |
{ | |
foreach (var item in Coordinates) | |
{ | |
var latLonSplit = item.Split(','); | |
var llpos = new Vector2d(double.Parse(latLonSplit[0]), double.Parse(latLonSplit[1])); | |
var pos = Conversions.GeoToWorldPosition(llpos, Map.CenterMercator, Map.WorldRelativeScale); | |
var gg = GameObject.CreatePrimitive(PrimitiveType.Sphere); | |
gg.transform.position = new Vector3((float)pos.x, 0, (float)pos.y); | |
} | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment