babylonjs

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

  • 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.