Latitude/Longitude to Unity position

Hello people!

I got a 3d environment which has tagged places and every place has a latitude and longitude value.

How can I map Latitude and Longitude values In that environment?

Basically I want to convert those latitude and longitude values into unity3d coordinates.

Similarly, how can I accurately map real GPS lat/long values to my environment? And show/hide environment if he is out of bounds…

Thanks a lot.

I would simply define 2 sets of coordinates: a top left and bottom right corner in world space (longitude / latitude) and a top left and bottom right corner in Unity coordinates - these coordinates define the bounding box of your playable area. By having them in both real world and in game coordinates, you can use basic interpolation mathematics to get the in-game position for real world coordinates.

I’ve found out the values of 1lat to unity meter and vice versa and same for 1lon to unity meter according the the data I had. I know that Building A has xyz coordinates (100,0,200) and lat long (20.111,50.111), can I use the conversion units to find out the lat long values? just ignore the Y axis

How accurate are you trying to be? In real world terms the curvature of the earth is significant for longditude. Your play space would need to be sepherical for this effect.

On the other hand for small localities direct mapping is fine.

± 20meters or some value near that.

Over what distance?

Over a couple of km this is fine. Over ten thousand km you will notice problems.

Yes almost in 1km radius. I used my own conversion method, it works fine for the two points,but when i try to mark a new place according to real maps the values are quiet different