# Can we trust y position of createPickingRay?

**URL:** <https://forum.babylonjs.com/t/can-we-trust-y-position-of-createpickingray/57354>\
**Category:** Questions\
**Tags:** ray, picking, pickwithray\
**Created:** [March 23, 2025, 10:54am UTC](https://forum.babylonjs.com/t/can-we-trust-y-position-of-createpickingray/57354 "2025-03-23T10:54:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ylacaute](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ylacaute/32/31802_2.png) [@ylacaute](https://forum.babylonjs.com/u/ylacaute)\
**Post date:** [March 23, 2025, 10:54am UTC](https://forum.babylonjs.com/t/can-we-trust-y-position-of-createpickingray/57354/1 "2025-03-23T10:54:57Z")

</div>

I have a flat ground. On mouse move, I use `createPickingRay` to get the ground mesh position at the mouse pointer and move a sphere at this position.

The sphere is always correctly positionned, so I think there is no bug.  
But when I log the sphere position with console.log I see that y position not always equal to 0 !

Sometime the sphere local position is different from absolute position, sometimes one is 0 while the other is -8 for example, sometimes both are valid or both invalid, this make no sense for me.

What does explain this behaviour and how to log the correct value ?  
Note: computeWorldMatrix change nothing

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

thanks

---

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [March 23, 2025, 2:26pm UTC](https://forum.babylonjs.com/t/can-we-trust-y-position-of-createpickingray/57354/2 "2025-03-23T14:26:04Z")

</div>

Can you double check: on my machine it is not 8 or -8 but e.g. “-8.881784197001252 **e-16** ”. So this looks like a floating point error.

Rounding to some lower significant digits can help. Or if you compare, you could [use epsilon](https://doc.babylonjs.com/typedoc/classes/BABYLON.Vector3#equalswithepsilon).

---

<div class="post-metadata">

**Author:** ![ylacaute](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ylacaute/32/31802_2.png) [@ylacaute](https://forum.babylonjs.com/u/ylacaute)\
**Post date:** [March 23, 2025, 3:22pm UTC](https://forum.babylonjs.com/t/can-we-trust-y-position-of-createpickingray/57354/3 "2025-03-23T15:22:17Z")

</div>

Thank you, sorry I am tired, I didn’t notice the **e-16** … 😅
