Running Cesium for Unity 1.13.1
In my tests I run a whole lot of raycast tests to find the Unity coordinates position of the ground to place objects, and I calculate them back to wgs84 elevation values to store them along their lat/lon geo position
I thought to replace these ray casts by SampleHeightMostDetailed, avoiding the need to bring the camera to the area to have rendered tiles for the ray cast.
To Isolate the test I have a simple setup with a cube.
The cubes position is Lat:32.0225895910763 Lon:34.7422150351583 H:30
An I attached a simple script to the cube :
using System.Collections;
using System.Collections.Generic;
using CesiumForUnity;
using Unity.VisualScripting;
using UnityEngine;
public class elevationtest : MonoBehaviour
{
public Cesium3DTileset tileSet = null;
public async void Start()
{
Unity.Mathematics.double3 positions = new Unity.Mathematics.double3[1];
positions[0].x = 32.0225895910763;
positions[0].y = 34.7422150351583;
positions[0].z = 0;
CesiumSampleHeightResult hr = await tileSet.SampleHeightMostDetailed(positions);
if (hr.longitudeLatitudeHeightPositions.Length > 0)
{
Debug.Log(“Elevation found Lat:” + hr.longitudeLatitudeHeightPositions[0].x + " Lon:" + hr.longitudeLatitudeHeightPositions[0].y + " Elevation:" + hr.longitudeLatitudeHeightPositions[0].z);
}
}
}
which gives me as debug.log : Elevation found Lat:32.0225895910763 Lon:34.7422150351583 Elevation:5.95650578786281
The cubes H is set to 30 and SampleHeightMostDetailed return 5.95
Did I not get the concept of SampleHeightMostDetailed right ? Or is there an issue in the calculation ?
Thanks !