# How achieve HeightReference effect with primitives

**URL:** <https://community.cesium.com/t/how-achieve-heightreference-effect-with-primitives/8708>\
**Category:** CesiumJS\
**Created:** [September 24, 2019, 1:53pm UTC](https://community.cesium.com/t/how-achieve-heightreference-effect-with-primitives/8708 "2019-09-24T13:53:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arcade92](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@arcade92](https://community.cesium.com/u/arcade92)\
**Post date:** [September 24, 2019, 1:53pm UTC](https://community.cesium.com/t/how-achieve-heightreference-effect-with-primitives/8708/1 "2019-09-24T13:53:05Z")

</div>

If is possible, how I can achieve effect like in that demo:

[https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Geometry%20Height%20Reference.html](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Geometry%20Height%20Reference.html)

but using primitives (instead of entities).

I want my primitives (polygons for example) be clamped to ground (but also extruded).

When I make my primitives as groundprimitives they lose their height.

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [October 3, 2019, 7:08pm UTC](https://community.cesium.com/t/how-achieve-heightreference-effect-with-primitives/8708/2 "2019-10-03T19:08:09Z")

</div>

The equivalent of a clamped polygon entity is a GroundPrimitive polygon. So you should be able to construct your geometry (with extrude etc) and just create it as a GroundPrimitive and it should be clamped. See:

[https://cesiumjs.org/Cesium/Build/Documentation/GroundPrimitive.html?classFilter=GroundPr](https://cesiumjs.org/Cesium/Build/Documentation/GroundPrimitive.html?classFilter=GroundPr)

You may find some of the “development” Sandcastle examples helpful, like this GroundPrimitive one:

[https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Apps/Sandcastle/gallery/development/Ground%20Primitive.html](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Apps/Sandcastle/gallery/development/Ground%20Primitive.html)
