# Wrong orientation and ‘getHeightAtCoordinates’ error

**URL:** <https://forum.babylonjs.com/t/wrong-orientation-and-getheightatcoordinates-error/54727>\
**Category:** Questions\
**Created:** [November 13, 2024, 9:12am UTC](https://forum.babylonjs.com/t/wrong-orientation-and-getheightatcoordinates-error/54727 "2024-11-13T09:12:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![marius\_margueray](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/marius_margueray/32/42474_2.png) [@marius\_margueray](https://forum.babylonjs.com/u/marius_margueray)\
**Post date:** [November 13, 2024, 9:12am UTC](https://forum.babylonjs.com/t/wrong-orientation-and-getheightatcoordinates-error/54727/1 "2024-11-13T09:12:13Z")

</div>

Hello, I’d like to make sure that every time I click the mouse, it sets a cylinder. So far, everything is working the way I want. But I would also like the cylinder when I place it to be in the same orientation as the ground where it is. So I get the normals to be able to rotate, the cylinder is oriented but not at all as I want…

I also have a second problem: if you try the playground, you’ll see that each mesh placed is in y = 1. this is normal because on line 200, I have the getHeightAtCoordinates which returns an error in the console …  
I must be using it wrong ?

thank you in advance for your answers and your help, which will be much appreciated!

> **[Babylon.js Playground](https://playground.babylonjs.com/?BabylonToolkit#AX3HQ9%235)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 13, 2024, 11:00am UTC](https://forum.babylonjs.com/t/wrong-orientation-and-getheightatcoordinates-error/54727/2 "2024-11-13T11:00:08Z")

</div>

getHeightAtCoordinates is a function tat exists only on a GroundMesh. The mesh you are using there is a `Mesh` object, so the function is not available for it.

About the first question - would you be able to elaborate a bit more about the issue? can you show a (simplified) playground that shows the incorrect behavior?

---

<div class="post-metadata">

**Author:** ![marius\_margueray](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/marius_margueray/32/42474_2.png) [@marius\_margueray](https://forum.babylonjs.com/u/marius_margueray)\
**Post date:** [November 13, 2024, 1:32pm UTC](https://forum.babylonjs.com/t/wrong-orientation-and-getheightatcoordinates-error/54727/3 "2024-11-13T13:32:09Z")

</div>

Hello, I’ve tried to condense a bit, but it’s complicated because the functions are ‘all’ linked to each other… but if I’m not saying anything stupid, it can only come from normals… or at least my way of doing things, which seems correct to me. The lines where I use normals are framed with ‘#########’ or from line 165-197.

> **[Babylon.js Playground](https://playground.babylonjs.com/?BabylonToolkit#AX3HQ9%236)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<div class="post-metadata">

**Author:** ![marius\_margueray](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/marius_margueray/32/42474_2.png) [@marius\_margueray](https://forum.babylonjs.com/u/marius_margueray)\
**Post date:** [November 13, 2024, 2:04pm UTC](https://forum.babylonjs.com/t/wrong-orientation-and-getheightatcoordinates-error/54727/4 "2024-11-13T14:04:23Z")

</div>

and to get back to getHeightAtCoordinate, is there an alternative way I can find the highest y at point x,z?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [November 13, 2024, 4:09pm UTC](https://forum.babylonjs.com/t/wrong-orientation-and-getheightatcoordinates-error/54727/5 "2024-11-13T16:09:29Z")

</div>

You can use scene.pick on your mesh from a position above the mesh (at x,y + 1000,z) and a vector to pick like 0,-1,0

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [November 13, 2024, 4:11pm UTC](https://forum.babylonjs.com/t/wrong-orientation-and-getheightatcoordinates-error/54727/6 "2024-11-13T16:11:39Z")

</div>

Like that:  
[Babylon.js Playground](https://playground.babylonjs.com/#PDZQ7M)

---

<div class="post-metadata">

**Author:** ![marius\_margueray](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/marius_margueray/32/42474_2.png) [@marius\_margueray](https://forum.babylonjs.com/u/marius_margueray)\
**Post date:** [November 13, 2024, 4:13pm UTC](https://forum.babylonjs.com/t/wrong-orientation-and-getheightatcoordinates-error/54727/7 "2024-11-13T16:13:29Z")

</div>

hooo thank you very much I’m going to try out this option
