# Is the HP\_Shape\_CreateHeightField function usable?

**URL:** <https://forum.babylonjs.com/t/is-the-hp-shape-createheightfield-function-usable/44191>\
**Category:** Feature requests\
**Tags:** heightmap\
**Created:** [September 16, 2023, 9:13am UTC](https://forum.babylonjs.com/t/is-the-hp-shape-createheightfield-function-usable/44191 "2023-09-16T09:13:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![x1911](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/x1911/32/35029_2.png) [@x1911](https://forum.babylonjs.com/u/x1911)\
**Post date:** [September 16, 2023, 9:13am UTC](https://forum.babylonjs.com/t/is-the-hp-shape-createheightfield-function-usable/44191/1 "2023-09-16T09:13:19Z")

</div>

I’m really excited to see support for the Havok engine!

I want to try using Babylon.js in our next project, but I noticed that the publicly available API doesn’t provide the functionality for a HeightField shape.

When will we be able to use this function to generate terrain?

Thanks

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [September 18, 2023, 3:54pm UTC](https://forum.babylonjs.com/t/is-the-hp-shape-createheightfield-function-usable/44191/2 "2023-09-18T15:54:40Z")

</div>

Adding @eoin and @carolhmj about this one 🙂

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 18, 2023, 5:14pm UTC](https://forum.babylonjs.com/t/is-the-hp-shape-createheightfield-function-usable/44191/3 "2023-09-18T17:14:17Z")

</div>

We have a HeightField Shape in the plugin, it’s just not exposed to Babylon 😅 I’ll move this up on my todos 😉 For now, it’s possible to use the Mesh shape.

Note that the function doesn’t generate the terrain for you, it just receives an existing one and creates the collision shape for it.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 18, 2023, 5:14pm UTC](https://forum.babylonjs.com/t/is-the-hp-shape-createheightfield-function-usable/44191/4 "2023-09-18T17:14:21Z")

</div>

Assigned @carolhmj on September 18, 2023, 5:14pm UTC



---

<div class="post-metadata">

**Author:** ![x1911](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/x1911/32/35029_2.png) [@x1911](https://forum.babylonjs.com/u/x1911)\
**Post date:** [September 19, 2023, 8:23am UTC](https://forum.babylonjs.com/t/is-the-hp-shape-createheightfield-function-usable/44191/5 "2023-09-19T08:23:07Z")

</div>

> [@carolhmj](#):
>
> Note that the function doesn’t generate the terrain for you, it just receives an existing one and creates the collision shape for it.

Yes, I’m currently using the mesh shape for my terrain.

In terms of performance, does a heightfield have any advantages? I

can’t wait to see the heightfield shape revealed.

Thank you very much for creating such an amazing library.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 19, 2023, 10:41am UTC](https://forum.babylonjs.com/t/is-the-hp-shape-createheightfield-function-usable/44191/6 "2023-09-19T10:41:05Z")

</div>

I believe a heightfield would be more efficient, am I correct @eoin ?

---

<div class="post-metadata">

**Author:** ![eoin](https://avatars.discourse-cdn.com/v4/letter/e/f14d63/32.png) [@eoin](https://forum.babylonjs.com/u/eoin)\
**Post date:** [September 26, 2023, 1:23pm UTC](https://forum.babylonjs.com/t/is-the-hp-shape-createheightfield-function-usable/44191/7 "2023-09-26T13:23:15Z")

</div>

The exact performance difference would depend on the scenario, but in general, I’d expect that for long raycasts, the heightfield will probably be a little faster (but we do try to make our raycasts pretty fast 🙂). For normal collision detection, there wouldn’t be a significant difference between a heightfield or a mesh - the biggest difference is mostly about the memory usage of each shape, as we can calculate few of the heightfield values on the fly.
