In the demo, you can start dragging from the green rectangle and move the pointer to the scene, where the mesh should follow the pointer.
Open problems:
Is there any other way how to switch movement behavior between ground and wall?
How to correctly assign the position of mesh to the pointer when drag start in HTML element. (scene starts to listen to plane coordinates only when pointer is out of HTML.)
Position of the mesh is not correct when drag starts on the ground.
I am wondering to hear some improvements or better solutions.
Is there any reason you are specifically using HTML for your UI? Babylon has its own GUI that you would be able to get the custom dragging working very quickly.
I’ll refer to an article for a demo I did about a year ago which had a drag and drop system.
If you do have to use HTML specifically, there should be drag/drop behaviors. When you drop you should be able to get the canvas position of the mouse and then convert that canvas coordinate using a projection matrix.
Surface magnetic behavior, in the word knowledge, the extent to which behavior can not define an object is that, for example, a picture can be hung on the wall, but it can not be spread on the ground, but can only stand on the ground