Im trying to use distance joint 2d to prevent my guy’s arms from flying away from the body but to no avail. I tried using spring joint 2d with frequency 0 like others suggested but same deal.
What am I doing wrong?
You need to figure out what you’re doing to cause that then because it’s obviously impossible to tell you what you’re doing wrong with only a screenshot.
Joints don’t just fly apart for no reason so check you’re working with the solver not against it by ensuring you’re not bypassing physics and directly setting transforms or body positions, modifying the joint arguments constantly, using crazy high/low mass ratios between bodies, long chains of joints and using the default solver iterations, running physics per-frame and having a low frame-rate and not using sub-stepping. The list of guesses goes on.
Your best bet here is to debug it yourself. Set up a simply test and see if it happens. If it doesn’t, start doing what you’re doing with the arms in your project.
The obvious thing from the looks of it is that the arm is outside that caravan which might suggest it’s being moved out of overlap with it, assuming again (because we only have an image) that it has colliders on it.
Basically debug it but if you cannot find it then please consider posting much more information on your setup, showing the colliders etc.