The main problem is that when I start placing the cube on the cube, the assistant cube starts to shake and is basically displayed one block away from the cube on which the cursor is. I recorded a video to make it clearer what I will enter. I changed the codepen and remove scroll, thanks for your prev answer.
I think the problem on this line voxel.position.divideScalar( 1 ).floor().multiplyScalar( 1 ).addScalar( 0.5 );
Changed the formula, works better, but still not as good as in the example. Cubes are placed directly on the intersection of the grid, and if you click on a separate place several times, the cubes will be placed one in one
Sorry for asking so much. Why, when I try to add a cube on the other side, it is placed at a distance of 2 from the cube on which the mouse is standing. Added a video to show the issue
For clarification: The problem is that the grid size is 1 as well as the length of the normal vector. The idea is to slightly scale the normal vector down so floor() produces the expected result.