# Container positions doesnt match scene.pointerX

**URL:** <https://forum.babylonjs.com/t/container-positions-doesnt-match-scene-pointerx/57338>\
**Category:** Questions\
**Created:** [March 21, 2025, 7:00pm UTC](https://forum.babylonjs.com/t/container-positions-doesnt-match-scene-pointerx/57338 "2025-03-21T19:00:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roy-Kid](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roy-kid/32/14651_2.png) [@Roy-Kid](https://forum.babylonjs.com/u/Roy-Kid)\
**Post date:** [March 21, 2025, 7:00pm UTC](https://forum.babylonjs.com/t/container-positions-doesnt-match-scene-pointerx/57338/1 "2025-03-21T19:00:01Z")

</div>

Hi everyone!

I am trying to add a right-click menu, but I got a weird problem:

1. I click on scene, and scene.pointerX/Y can get coordinates of cursor in pixel unit;
2. Although it’s not integer due to [Why are scene.pointerX and scene.pointerY not integers? - #7 by wulf11](https://forum.babylonjs.com/t/why-are-scene-pointerx-and-scene-pointery-not-integers/43547/7), but I think it doesn’t matter;
3. I create a container with the XY (container.left=X…) but container wont show near my cursor
4. the more cursor off the scene center, the more container shift away cursor.
5. The XY i got is correct, i have calibrated on the corner of scene, and compared with canvas size.
6. the funny thing is I cannot reproduce it in playground…

Here is a screenshot: I hardcode container at (1000px, 500px), and red point is where scene.pointerX, Y equal to this value.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/9/b922038e1e40d51087794451d649d4e7d91285d9.png)

Can you please give me some advice how to debug this?

Sorry for this confusing question…

Bests,

---

<div class="post-metadata">

**Author:** ![alexchuber](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alexchuber/32/52000_2.png) [@alexchuber](https://forum.babylonjs.com/u/alexchuber)\
**Post date:** [March 21, 2025, 7:41pm UTC](https://forum.babylonjs.com/t/container-positions-doesnt-match-scene-pointerx/57338/2 "2025-03-21T19:41:15Z")

</div>

Although I hear that the issue doesn’t repro in the playground, could you provide one anyway that shows what you’re trying to do? It would help with debugging. Thanks!

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [March 21, 2025, 8:35pm UTC](https://forum.babylonjs.com/t/container-positions-doesnt-match-scene-pointerx/57338/3 "2025-03-21T20:35:10Z")

</div>

Here is the example of the GUI Context Menu on the Right Click - [https://playground.babylonjs.com/#PIKP4K#16](https://playground.babylonjs.com/#PIKP4K#16)
