how can these pieces snap to each other sides?
Can you add more context? Is this a puzzle game? Will the snapped pieces lock together and move as a whole? Is it freeform, can you build anything or is it fixed so that only a particular shape can be built?
If it was a fixed puzzle then you could add objects that the dropped pieces would snap to. Like placeholders.
If it was more freeform then I played with the concept with 2 instances of the object named Piece. The object had just 1 point placed between 2 corners. I made the collision mask slightly larger than the shape to add some tolerance.
It rotated one of the instances.
Using the drag behavior, this works with a simple setup with just 1 point.
Now, to use this in a more complex way, the pieces would need more points. You could then compare the distance between each point on the dragging object with each point on the stationary object(s) and pick the shortest distance.
My other thought would be to stick objects to the midpoint locations and compare the distances that way. I didn’t test that method. The test objects could be permanent or only placed for testing purposes.
That’s all that I got.