How to find in game lat / long?

how to find in game lat / long ? like howww and thanks. I already find the ( x , y z ) but its totally different ?

There is no out-of-the-box feature for this. You would have to make one.
You could use the X and Y coordinations for this and build your system based on it…

Hmm, basically you want to convert a Vec3 to polar coordinates. Assum r is the radius if your sphere and X,Y,Z the spacial coordiantes:

latitude = Acos( Y / r )

longitude = Atan(X / Y)

122397-sphere.png

IE this image:

thetha is your latitude, phi the langitude

latitude = Acos( Y / r )

lets say
x = 1
y = 2
z = 2
r = radius of Earth ?

so Cosine ( 2 / 6,371 ) ? is that right ? sorry im trying my best here :slight_smile:

I’m not sure if you know whats the difference between spacial coordinates and a lat/long system.

The earth is a sphere (lets say it’s perfect round).

UE4 is a “flat” world by default, if you add a plane, it’s just a plane, so you probably want to add a giant ball you can drive on. If you add this ball you can insert a radius somehow. If you are given this ball, and its middle point is (0,0,0), you can calculate the radius if you have ANY point on this ball, in your examle the radius is sqrt(1²+1²+2²) = 3.

If you are given some lat/long coords by your task somehow (your boss says he wants to drive that car through a town and you get the GPS dates in lon/lat) and you have this town in Unreal, but flat, not on a ball, you have to go the other way round (different formulars)

yup mine is the second option .Its a gps kind of thing that uses the lon/lat. Whats the other formula for that if i may ask ?

x = r * cos(lat) * cos(lon)

y = r * cos(lat) * sin(lon)

z = r *sin(lat)

(I just googled them)

The Radius is about 6371km → 637100000 in Unreal units, don’t know if a float can handle this easily. I’m not even sure if you can handle gps with float, its not that precise

Thank you very much for your comment :slight_smile:

for now i just want the lat long to be done. THANK YOU VERY MUCH although my math is really not good . i need to make lat = something something and lot = something something for the formula

I know this question have been answered years ago. But I’m facing the same issue right now. And tried the formulas up there, didn’t work for me. Any Idea?