My goal is to be able to drag an object and have it snap to the surface of another. Whether it snaps upon release or updates live doesn't matter to me.
The ultimate objective is to create a smooth shape in Blender, import it, and enable snapping while dragging it. While I know how to achieve this with procedurally generated surfaces using some math, I am interested in applying this to non-procedurally generated surfaces that I haven't figured out how to generate yet.
I experimented with modifying the 'click' effect from this example: to a 'drag' effect. I then integrated it with this example:
The current setup allows me to drag cubes across the sphere and highlights the face as expected.
However, when trying to snap the dragged objects to the face of the sphere using the following flawed logic:
SELECTED.position.x = intersectsRay[0].face.normal.x;
SELECTED.position.y = intersectsRay[0].face.normal.y;
SELECTED.position.z = intersectsRay[0].face.normal.z;
The issue arises as the dragged objects always snap to the center of the sphere...
This is likely because the face 'normal' represents the center of the sphere in this scenario.
If anyone has any suggestions on how to determine the x,y,z coordinates of the FACE (regardless of its shape) or any alternative approaches to implement this idea, please let me know.