Coincidently Jason answered at the same time I was working on a quick demo of how I’d approach this
https://playground.babylonjs.com/#2MNDQN#1
I think the invisible object would definitely be a good example to start. In my playground, I used the green box as the attachment point (of course, this would be invisible in an actual aplication, but it’s easier to explain the idea when it’s visible).
When I click the yellow box and start dragging on the x direction, I keep track of what are going to be the future bounds of the object and compare them to the green box’s bounds. If they overlap, then I “snap” the yellow box to a fixed position and stop the dragging behaviour. The green box is slightly bigger than the red box because having such a “breather space” in intersections usually lead to better experience for the user.