# Clamp Cesium3D tileset to terrain boundary

**URL:** <https://community.cesium.com/t/clamp-cesium3d-tileset-to-terrain-boundary/22068>\
**Category:** CesiumJS\
**Created:** [January 25, 2023, 4:48am UTC](https://community.cesium.com/t/clamp-cesium3d-tileset-to-terrain-boundary/22068 "2023-01-25T04:48:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![humanAlphabet](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@humanAlphabet](https://community.cesium.com/u/humanAlphabet)\
**Post date:** [January 25, 2023, 4:48am UTC](https://community.cesium.com/t/clamp-cesium3d-tileset-to-terrain-boundary/22068/1 "2023-01-25T04:48:03Z")

</div>

Hello

Is there any way to clampToGround the Cesium3D Tileset to terrain boundary ? Because my Cesium3D tileset is at the middle of the terrain I want it to clamp the top of the terrain boundary. I really appreciate it! Thanks!

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [January 31, 2023, 4:09pm UTC](https://community.cesium.com/t/clamp-cesium3d-tileset-to-terrain-boundary/22068/2 "2023-01-31T16:09:23Z")

</div>

Hi there,

Here’s [a code snippet for how to adjust the height of a 3D tileset](https://sandcastle.cesium.com/?src=3D%20Tiles%20Adjust%20Height.html).

You can sample the height of terrain at a specific position using the `sampleTerrain` function as [shown in this example](https://sandcastle.cesium.com/?src=Terrain.html).
