# Tangram puzzle game

I am trying to create a tangram puzzle game. I can drag the shapes into place and rotate them, but how do I detect when all pieces are in place? I am doing this in 2D and I have a sprite of the shape of the puzzle. I have tried Raycast, OnBecameInvisible, but I am just not sure the best way to achieve this. Also I would like the shapes to snap to the puzzle sprite but I am not sure how to achieve this. Here is a image to give you an idea.

just been having a wee read through, im just learning so best i can do is to chuck in an idea to get conversation going with what i know (not a great deal lol)

just thinking off to top of my head, what if you create an empty gameobject, with a small circle trigger collider, at the target location of the tile.
and say the piece you are moving around, hits that collider when you drop it.

if there is a collision, you can check if the centre point distance of both these pieces to see if its within a small tollerance.
then if they are you can check to see if the rotation of the piece your moving is at the correct rotation.
if both these match, then you could set the transform of the piece your moving to the same as the empty gameobject that you have as a target.

just off the top of my head, cant think of any other way at the mo…

Thanks for the input. I have tried several different things. 1st randomly generate puzzle by placing the sprites on the screen, but the gaps were too big and not very changing. Next I tried to randomly spawn shapes at top of the screen at random x coordinates and random rotations and apply gravity let them fall and form the puzzle, while better than my first attempt still had too many gaps between shapes. So 3rd attempt I made a sprite that was a negative of the puzzle. That is was black everywhere except where pieces go there it was transparent. then I made a polygon collider of the negative and added a rigribody2D. Now when I try to place the pieces I can only place them within the puzzle. Now I was thinking of calculating the bonds of the puzzle sprite and one all pieces are within the sprite bounds then load next level, and since the pieces will only fit in one way I think this will work.