The height corresponding to the latitude and longitude of the object

Hello, I am currently using the CESIUM globe anchor to control the latitude, longitude and height of the object, but there may be a situation where the object is floating in the air or the object is underground, is there a way to make the object stick to the surface of the earth created by CESIUM for Unity, without setting the height at any time to ensure that the object is attached to the surface of the earth, or you can obtain the height of the ground in real time to set the height of the object

For example, in the following case, if I only change the latitude and longitude of the object without changing the height, the object may appear underground, because I receive a message that only the two-dimensional latitude and longitude do not involve height, what method should I use to control the object in real time is always on the surface of the earth

There’s currently built-in way to do this. You can use a Linecast to find the height of terrain at a given 2D point. Be aware, though, that the height can change as the terrain level of detail shifts.

In the future, we plan to add a way to directly get the terrain height at a particular location. Keep an eye on this issue:

I also have a question, I was looking for Unity to use Linecast based on colliders, but Cesium World Terrain does not seem to have a unified collider, how to solve this problem

I’m afraid I don’t know what a “unified collider” is. A line cast into Cesium World Terrain should work just fine, though, as long as you haven’t disable the “Create Physics Meshes” option on the Cesium3DTileset.

At the beginning, I was unable to achieve the desired result due to the reverse direction of the line segment in Unity. Thank you very much for your help

I’m facing a scenario where objects occasionally end up floating in the air or even sinking underground. I’m eager to find a way to ensure that my objects stay consistently aligned with the dynamic terrain surface created by CESIUM for Unity. Ideally, I’d like the objects to seamlessly stick to the terrain without manually adjusting their height all the time. Is there a technique or approach within CESIUM that allows objects to naturally conform to the terrain’s surface?

No, there’s currently no easy out of the box way to do that. We recognize the need, though, and would like to provide one in the future. In the meantime, line casts are the best available option.

I’ve tried this but there are some places where the raycast is not hiting.
Is the mesh also set for the sea?

Yes, there’s a mesh for the sea as well. However, tiles that are not currently visible are not shown by default, and so it’s not possible for a raycast to hit them. See here, especially the part about “Tile culling and LODs”:

Hello, has this function been updated?