I have 2 objects, both have RigidBody, Orange with mass 1, Red with mass 1000.
I freezed the XY positions and Z rotation of the Orange.
Red has a DistanceJoint2D component which has connected to RigidBody of Orange.
When I hit play and the Red start swinging under the Orange, the distance between them increased and then turn back, like a spring.
I wondering why does this happen? It supposed to maintain the fixed distance, right?
This is a limitation with how joints work. They are pretty much the jankiest part of unity physics. This happens because joints work by trying to apply a force that will put objects where they are supposed to be, and under the hood they are basically all springs, and when there are high masses, or high differences in masses, it fails to make the objects stable. On some of the more advanced joints there are settings for spring force and damping which can help reduce this, but it requires a lot of tweaking and never gives a perfect result.