- Home /
Question by
adarshnambiar · Oct 26, 2017 at 08:04 PM ·
augmented-reality
Place a Unity game object at a Geo Location using Mapbox + ARkit
Hi All,
How do we instantiate a game object at a specified geo location using Mapbox and Arkit plugin(here). I m using following code
void PlaceObject(Mapbox.Utils.Vector2d loc)
{
Debug.Log("PlaceObject at : " + loc);
Mapbox.Utils.Vector2d spawnLocation = new Mapbox.Utils.Vector2d(loc.x, loc.y);
Vector3 _targetPosition = Conversions.GeoToWorldPosition(spawnLocation,
positionWithLocationProvider._map.CenterMercator,
positionWithLocationProvider._map.WorldRelativeScale).ToVector3xz();
Debug.Log("_targetPosition at : " + _targetPosition);
GameObject currObject = Instantiate(SpawnObject);
Vector3 currentPosition = new Vector3(_targetPosition.x, 3, _targetPosition.z);
currObject.transform.position = currentPosition;
}
It spawns at a completely different location.Should I be doing something else?
Comment
Your answer

Follow this Question
Related Questions
Cloud recognition in Vuforia 0 Answers
please please please Any one have an idea how to do this (( really good )) 1 Answer
augmented reality long distance 3 Answers
Supplying downloadable data 0 Answers