How locate click when "pointerLock"?

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?

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

1 Like

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

1 Like

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

Are you making a landscape topology tool?

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
I changed the height of y from 0 to 19 but nothing happened.Can you show me where my code is wrong? Thank you