I have created jigsaw pieces by creating a mesh of points. I now want to add a collider that reflects the shape of the jigsaw piece. I'm new with this discord thread but I added a picture of how my shape usually looks like. However, for debugging purposes I have chosen a simper shape and that is in the other images. The solution should work for both.
If I create a bunch of duplicates for the points, to make segments. I can make a concave collider that looks my piece (the simplified cubey piece). However, a hollow collider won't work. I want my mouse to collide with the piece to be able to pick it up and drag it. Concave colliders are always hollow? So I cannot use a concave collider? But the shape is concave?
If I try with a convex collider instead, it looks correct. (The blue is from when I have collision shapes Visible Collision Shapes on). But the collision doesnt work, I used signal mouse entered and mouse exit. When trying with a square piece (flat sides on all sides, impossible on a real puzzle :P) the mouse entered signal works so it isnt that. I get the warning: "Concave polygon is assigned to ConvexPolygonShape2D. So convex collider is probably not the way either.
How should I tackle this problem? I guess that it is possible to divide the jigsaw piece into multiple colliders but that feels quite hard for my more traditional looking jigsaw pieces. I would like to create some variations aswell in the future. I would have hoped that I could just input my points that define the shape and get a collider someway. Is this possible?
I talked with a friend and he told me that instead of colliders I could use a shader of some sort. He said that I could do something along the way with assingning the puzzle piece id to each pixel in a piece. And then when the mouse pointer is above a pixel you can check for the id. Idk, that solution feels a bit strange.
Would be happy to get some help/ideas :)