I make a demo physics attach unattach
switch type0 to type1,ok
switch type0 to type2,ok
but switch type1 to type2, make bug ,why?
Maybe when you unattach the attach id still exists and you try and unattach again but it is not attached. So try setting the attach id to null when you unattach it.
demo in physics attach unattach v2
switch type0 to type1
switch type1 to type2 and type0 to type2
but type2 to type1
the two type1 have no same result
If your join location is in the center of the rectangles then this would be possible depending on starting positions. The blue ones could be rotated with the insides rotated up like in the first case with a narrow start and rotated down like the last case with a wider start. I am just guessing. Do some more experiments.