Snap between objects

I’ve got a new issue, and honestly, I’m almost embarrassed to admit that I just can’t figure out what’s happening here. I tried to simplify the situation as much as I could.
There’s a scene where I’m trying to snap two objects together: one that’s movable and another that’s positioned somewhere in the scene and attached to a different object. The weird thing is, this snapping works sometimes and other times… not so much. If it seems to work right off the bat, try panning the camera in different directions and… it’ll break
Here is the pg:
And visual example

Any idea is welcome? Thanks :fire:

Your algorythm does not account for the shape of the mesh you drag so depending where you click on it, you will create an offset.

You would need to check for each side if it should snap or not.

A quick example of how you could force the correct x here:

The other dimension will highlight the offset issue.


No waaaay :astonished: It seems that I am like gpt, over time I become dumber :sweat_smile:
Thank you! :beers: