0

I am making a game based on real world coordinates, and i want to do this: Gameobject position is normally im X Y Z, but i dont have that values, i want to make custom position values, that look for example like this: Image

So the square is an 3d model of real world city, and the numbers are minimum and maximum lat and Long of the area. Is this possible to like create custom position values (for example my current position is 16.51128, 60.52228 and I want unity to calculate the position from minimum and maximum values)

  • 1
    I think you'll need to code an algorithm to do this for you. The Bing Quadkey calculations might be a useful reference. – Elliveny Jun 22 '22 at 16:57
  • Check the FromCoordinatesToPixel method in Jader Dias answer here: https://stackoverflow.com/questions/2651099/convert-long-lat-to-pixel-x-y-on-a-given-picture - it should get you on the right path – Elliveny Jun 22 '22 at 17:55

1 Answers1

1

You're saying you don't want to use Cartesian coordinates (x, y, and z), that you want to use latitude and longitude, but then the example of what you want is a rectangle.

If you want a rectangle, you're better off using Cartesian coordinates. If you really want to use latitude and longitude then what you're saying is that you want to deal with map projection issues.

Latitude and longitude describe your position on a sphere/spheroid, and to then convert from that rounded ground plane to something Unity can use (which is natively Cartesian) will require you to write your own version of a map projection like Universal Transverse Mercator.

All of this conversion from lat/long to UTM would ultimately be so you can locate your objects in a Cartesian coordinate system.

Skip the heartache and just stick with Cartesian coordinates from the start. I'm promising you it's not worth the pain.

Chuck
  • 1,977
  • 1
  • 17
  • 23
  • I mean, I want to use Cartesian coordinates, but I think that it would not be possibile to get them from my current position (I'm making an detailed map to navigate though city) – Igi Paligi Jun 23 '22 at 21:35
  • I don't know what you mean when you say `it would not be possible to get (Cartesian coordinates) from my current position`. – Chuck Jun 24 '22 at 13:07