Clamp_to_ground in Unity

Hi community,

We would like to display undersea cables and pipelines on the seabed in Unity using Cesium World Bathymetry. Is there a similar feature for Unity as for CesiumJS: Cesium.HeightReference.CLAMP_TO_GROUND?

Regards,
Eugen

Hi @ereiswich, there is not yet a feature to automatically clamp objects to the surface. However, you can use the SampleHeightMostDetailed method on Cesium3DTileset to query heights and then place objects there.

Thanks Kevin, I’ll give it a try.

I am basically wondering how georeferenced objects such as LineStrings, Polygons (with height) can be displayed in Cesium for Unity. I’ve been working for years with CesiumJS. In CesiumJS there are Entities that can be a polyline, polygon etc. These have lat/lon coordinates in a PolygonHierarchy and can be passed on to the Cesium Map for visualization via a CustomDataSource and voila!

For example, we use a REST-service to load a GeoJSON with lat/lon coordinates and need to create an extruded Polygon in our Unity-Scene on top of a Cesium globe (similar to this: Cesium Sandcastle). What do we have to create programmatically from the GeoJSON so that we can display it on a Cesium map in Unity?

Cesium for Unity unfortunately doesn’t have CesiumJS’s support for vector data rendering yet. So you’ll need to create your own Unity GameObjects to render the GeoJSON elements however you like. I haven’t tried to do this myself, so I don’t have any specific advice for you. The methods on CesiumGeoreference will be useful for turning geospatial coordinates into Unity world coordinates. For the actual rendering, though, you might look at Unity’s splines package, generating meshes programmatically for extruded polygons, or perhaps even looking for a third party plugin that can help here. I found this with a quick search:

Thanks Kevin for the clarification. Now at least we know which way to think. We looked at the spline package, but couldn’t see how to create polygons with a height. We’ll take a look at the GitHub project you referenced.