'Grid Snap tool in babylon js for proper wall construction

I would like to implement a snap grid function in my pointer, but it seems when I zoom in or out, the grid distance changes. Is there a solution for this?

Here is the playground: https://playground.babylonjs.com/#VHW8N9#2

I created the grid using this

scene.pick(Math.round(scene.pointerX/100)*100, Math.round(scene.pointerY/100)*100)


Solution 1:[1]

I already found a solution for this in this playground, https://playground.babylonjs.com/#VHW8N9#3. If someone is facing the same issue, this may help.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matheus assi