Hey there, I've been working with the Unity SDK for a bit, but I'm struggling in this one aspect.
Say I have a latitude and longitude, , how can I then convert those coordinates into Unity world coordinates? Ideally I'd want to do this without having to create a gameObject with an ArcGISLocationComponent.
I've seen a few functions around that seem close to what I want, but not quite. Unless I'm misunderstanding what some of these functions do, because the documentations/comments mix up terms like "geo, world, engine" that makes it confusing to figure out what exactly is being converted to what.
public static ArcGISPoint HitToGeoPosition(Vector3 point, float yOffset = 0)
{
double3 worldPosition = math.inverse(map.WorldMatrix).HomogeneousTransformPoint(point.ToDouble3());
ArcGISPoint geoPosition = map.View.WorldToGeographic(worldPosition);
ArcGISPoint offsetPosition = new ArcGISPoint(geoPosition.X, geoPosition.Y, geoPosition.Z + yOffset, geoPosition.SpatialReference);
return GeoUtils.ProjectToSpatialReference(offsetPosition, new ArcGISSpatialReference(4326));
}
double3 worldPosition = arcgismap.View.GeographicToWorld(ArcGISPointPosition);