Convertion to Unity not giving same values when only heigh has changed

I have a function to convert from Longitude, Laitude and Height and when I call it with same latitude and longitude but different height is giving me differente values in all the coordinates, is this correct?
This is my function:
Note there is an adjustment if the height that is coming is below the Y value of the 3DTileSet return the value of the map Y.

private Vector3 GetUnityPosition(double latitude, double longitude, double altitude)
    var height = GeoidHeights.undulation(latitude, longitude);

    var pos = new double3(longitude, latitude, height + altitude);
    Debug.Log($" GetUnityPosition: Position {pos}");
    var ecef = CesiumWgs84Ellipsoid.LongitudeLatitudeHeightToEarthCenteredEarthFixed(pos);
    Debug.Log($" GetUnityPosition: ECEF {ecef}");
    var unityPosition = CesiumComponent.GetComponent<CesiumGeoreference>().TransformEarthCenteredEarthFixedPositionToUnity(ecef);
    Debug.Log($" GetUnityPosition: UnityPosition {unityPosition}");
    var position = new Vector3((float)unityPosition.x, (float)unityPosition.y, (float)unityPosition.z);
    var mapPosition = GetMapPosition(position);

    if (position.y > (float)mapPosition.Item2.y)
        return position;
        var newUnityPosition = new Vector3(position.x, (float)mapPosition.Item2.y, position.z);
        Debug.Log($" GetUnityPosition: NewUnityPosition {newUnityPosition}");
        return newUnityPosition;

These are the logs for two calls with simiar longitude and altitude
GetUnityPosition: Position double3(-96.7676162719727, 32.8526954650879, 503.441769652035)
GetUnityPosition: ECEF double3(-632082.156804792, -5326404.26096664, 3440519.35399537)
GetUnityPosition: UnityPosition double3(24536.5783976775, 451.38818237558, 7897.70696547861)
GetUnityPosition: NewUnityPosition (24536.58, 451.39, 7897.71)

GetUnityPosition: Position double3(-96.7676162719727, 32.8526954650879, 903.441769652035)
GetUnityPosition: ECEF double3(-632121.755166528, -5326737.94683391, 3440736.34641859)
GetUnityPosition: UnityPosition double3(24538.1155527714, 851.384919896722, 7898.2040837938)
GetUnityPosition: NewUnityPosition (24538.12, 851.38, 7898.20)


Quick sanity check, looks ok to me.

When projecting from WGS84 ellipsoid space (lat long, height) to Unity 3D coords, I think it’s reasonable to expect a height change to change all 3 coordinates in Unity space.

The ellipsoid position you are working with most likely does not have its normal lined up perfectly with Unity’s up (Y axis). This is the only case I can think of where height and Y would move together in isolation.

From what I can tell of your 2 test points, you are changing height only, and Y is mostly affected, with X and Z only changing a little. This suggests that your terrain is georeferenced somewhere pretty close to Unity’s origin, with the terrain’s up mostly pointing in the same direction as Unity’s up (Y). This is the common case for how we expect users to set up a scene. So, looks like you are in the ballpark here.

There’s a great book that covers these concepts too…