GPS coordinates (lat/long/altitude) to Unity 3D coordinates (x, y, z)

Hi,

I’m trying to put the Unity camera into the “real” 3D space by reading the GPS coordinates and converting them to Unity 3D coordinates, and then setting the camera position to those 3D coordinates. I’m also trying to put some objects into the “real” space around the user, so they show up when the user points his mobile device at those objects (I’m using the gyroscope to detect the rotation).

The problem I’m having is that I can’t seem to find a method to convert those GPS coordinates to Unity 3D coordinates so they match up (I know they can’t match up 100%, but in my case they don’t match even slightly). I’ve tried a few methods that were mentioned here, I even tried converting the method found here to C# (the function called llhxyz, along with its related functions that calculate the constants), but even that didn’t give me satisfying results. I am also aware that the ECEF XYZ coordinates are not equivalent to Unity’s XYZ, but even switching them around doesn’t help.

Can anyone push me in the right direction or tell me what I’m doing wrong?

First of all there is no answer “how to convert lat/long to Unity coordinates”, because Unity coordinates can be anything. There is no official rule how you convert real world, to Unity coordinates. It all depends what you choose your Unity coordinates to be.

The most simple thing would be to treat lat/long/altitude as coordinates on a sphere (that’s what they are) and just render such sphere with user position in Unity. If that’s not what you’re after, then you have to modify to what Unity coordinates in your project mean.

@schpinn
l.O,
Did you succeed to do what you want ?
COuld you tell me how to do all of this ?
I would like to do exactly the same thing and it is urgent
thanks for all
my mail :mmmklmail@gmail.com