Search Unity

For the Developers... Coordinate System(s)

Discussion in 'Editor & General Support' started by Rickmc3280, May 17, 2019.

  1. Rickmc3280

    Rickmc3280

    Joined:
    Jun 28, 2014
    Posts:
    189
    Coordinate Systems are pretty important in the real world for engineering/survey/etc... and having said that along with the fact that Unity is pushing for AEC...

    I would really appreciate help in regards to figuring out a solution for using our real world coordinates ( WGS84: Unifying a Global Ellipsoid Model with GPS - https://gisgeography.com/geodetic-datums-nad27-nad83-wgs84/)

    I am trying to develop a platform using our point cloud data which is tied into Survey Coordinates and I need to be able to get those exact coordinates.

     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,443
    i've seen some c# libraries to convert between different coordinate systems, but wasnt able to find or remember it right now.. it might had been some proj.4 .net version or similar.

    but in any case, if you use that manual offset idea,
    where you original point data coordinate could be some really large value, 6034345.432434 (in meters)
    then you offset it by some fixed value, like -6034345, and do the same for all the clouds,
    then you can convert between unity and your coordinate system, by adding/subtracting that fixed offset to it.
     
  3. Rickmc3280

    Rickmc3280

    Joined:
    Jun 28, 2014
    Posts:
    189
    The issue with the point cloud is that it is tied to the coordinate system that I mentioned above. The major reason that it is an issue as I am doing more digging and trial and error is that the coordinates have so many digits that it Needs to be translated to a 64bit floating system. Because of the precision (lidar data) some of the points have too many numbers for 32bit floats.

    Mgear- am I misunderstanding floating numbers? 7 digits precision vs 15? Or are the 15 digits all after decimal?

    I was getting issues with a loss of precision and when throwing objects in they end up where they aren't supposed to be, so my assumption was because there aren't enough total numbers available to be written, (pre or post decimal).

    Are the coordinates within Unity 32bit or 64bit because as you know, my issue is only with it putting the cloud in pro ably the right location.

    My thoughts were to try to write a script to find the average elevation or make a secondary set to import a cloud, find its coordinates and write a camera to that position but from what I was told it may make sense to write my own coordinate handling system so that I can bring all of my mesh, stls, objs, and other files in on each other.
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Unity uses 32 bit floats for its Vector3, which is used for all game world positioning. This generally works fine when not far from origin and at "normal" scales, but will give some trouble when needing good precision further away from origin. For example, if object1 needs to be positioned 0.001 above object2, that works fine when object2 is at 0,0,0. It does not work fine when object2 is at 0,100000,0. You will see some errors in object1's positioning relative to object2 in that case.