I am trying to make a modular vehicle editor similar to Kerbal Space Program. The user selects an initial vehicle part which is spawned in the center of the "work area". To add another part to the initial one, the user clicks and drags a part from a list onto the "work area" and then drags that part towards the initial one. When a node on the new part is close enough to a node on the initial part, the new part snaps onto the initial one. The user can then click to confirm the connection or drag it somewhere else. For a visual example.
The spawning of the parts I have no problem with.
For moving the parts in the environment I have an invisible plane that is parallel to the camera and rotates to always face the camera. I then draw a ray from the mouse to the plane and update the parts position to the location where the ray hits the plane.
When the new part is in the correct position I will add I make it the child object of the part I want to connect it to.
The problem occurs with positioning the new part relative to the part I want to attach it to. I'd like to make it like Kerbal Space Program where when the connecting node of the new part is within range of the connecting node of the part I'm attaching to, the new part's position snaps to the part I'm attaching to.