Ironically enough, the best glue for toys is the $2 ones from the Reject shop.
Just apply a bit on both ends and stick them together. Apply pressure for about 30s to a minute and let it dry for about 5-8 minutes. It should turn out pretty solid but make sure no glue ends up on the pin as that has to have free movement or the plastic will break.
I had a look at the Megatron I repaired. As mentioned, the pin moves without friction on the joint on the torso while moving with the 'shoulder blade' panel. The trick is that there should not be any friction on the pin at all.
Note that the pin should only move loosely with the 'shoulder blade' within the joint highlighted :
![]()