0

I need to place 3d models at gps lat/lon degree coordinates which correspond with unity x/y coordinates and for that I need to convert the gps data , i.e, latitude and longitude in degrees to x, y coordinates in unity for my project in Augmented reality using Vuforia. Can someone help me with a C# script which handles the conversion without compromising precision?

1 Answers1

1

As shown on this Unity Forum post you can convert Lat/Lon to X/Y with the following code:

public float latitude;
public float longitude;
Vector3 xyz_vector = Quaternion.AngleAxis(longitude, -Vector3.up) * Quaternion.AngleAxis(latitude, -Vector3.right) * new Vector3(0,0,1);
SebRut
  • 585
  • 4
  • 22