# How locate click when "pointerLock"?

**URL:** <https://forum.babylonjs.com/t/how-locate-click-when-pointerlock/6385>\
**Category:** Questions\
**Created:** [October 15, 2019, 12:12pm UTC](https://forum.babylonjs.com/t/how-locate-click-when-pointerlock/6385 "2019-10-15T12:12:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![HUY\_HOANG](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/huy_hoang/32/4913_2.png) [@HUY\_HOANG](https://forum.babylonjs.com/u/HUY_HOANG)\
**Post date:** [October 15, 2019, 12:12pm UTC](https://forum.babylonjs.com/t/how-locate-click-when-pointerlock/6385/1 "2019-10-15T12:12:00Z")

</div>

Hi, I need your help  
How do I locate the click in the center of the screen on a ground grid or object when I’m using “pointerLock”? Can you give me an example?

---

<div class="post-metadata">

**Author:** ![Drigax](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/drigax/32/16585_2.png) [@Drigax](https://forum.babylonjs.com/u/Drigax)\
**Post date:** [October 16, 2019, 12:44am UTC](https://forum.babylonjs.com/t/how-locate-click-when-pointerlock/6385/2 "2019-10-16T00:44:11Z")

</div>

I don’t think using the pointer position is the best way to pick objects when using pointer lock, here’s a modified playground that raycasts from the camera center point instead, hopefully this helps?:

[https://www.babylonjs-playground.com/#1BAPRM#211](https://www.babylonjs-playground.com/#1BAPRM#211)

---

<div class="post-metadata">

**Author:** ![HUY\_HOANG](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/huy_hoang/32/4913_2.png) [@HUY\_HOANG](https://forum.babylonjs.com/u/HUY_HOANG)\
**Post date:** [October 16, 2019, 3:40am UTC](https://forum.babylonjs.com/t/how-locate-click-when-pointerlock/6385/3 "2019-10-16T03:40:45Z")

</div>

Thank you this is what I am looking for. Does this work for ground? I need to find and change the vertexdata grid height at that position

---

<div class="post-metadata">

**Author:** ![Drigax](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/drigax/32/16585_2.png) [@Drigax](https://forum.babylonjs.com/u/Drigax)\
**Post date:** [October 16, 2019, 6:12pm UTC](https://forum.babylonjs.com/t/how-locate-click-when-pointerlock/6385/4 "2019-10-16T18:12:09Z")

</div>

It should work for any type of Mesh, but you’ll just need to make some slight adjustments, instead of creating the decal (or whatever on raycast hit effect you want) on cat, you should instead use pickInfo.pickedMesh. Here’s a modification of the scene to show you what I mean:  
[https://www.babylonjs-playground.com/#1BAPRM#213](https://www.babylonjs-playground.com/#1BAPRM#213)

Are you making a landscape topology tool?

---

<div class="post-metadata">

**Author:** ![HUY\_HOANG](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/huy_hoang/32/4913_2.png) [@HUY\_HOANG](https://forum.babylonjs.com/u/HUY_HOANG)\
**Post date:** [October 18, 2019, 5:35pm UTC](https://forum.babylonjs.com/t/how-locate-click-when-pointerlock/6385/5 "2019-10-18T17:35:52Z")

</div>

I am creating a tool to change terrain up and down but I am having problems with “updateVerticesData”  
This is my code [https://www.babylonjs-playground.com/#CPJ8YP#2](https://www.babylonjs-playground.com/#CPJ8YP#2)  
I changed the height of y from 0 to 19 but nothing happened.Can you show me where my code is wrong? Thank you
