Quick answer: Use the joint’s Frequency (Hz) and Damping Ratio rather than scripting spring constants directly. These are mass-aware and produce consistent behavior regardless of body mass changes.
Here is how to fix Unity SpringJoint2D where doubling the connected body’s mass dramatically changes the wobble. The Frequency parameter is mass-stable; spring stiffness alone is not.
The Symptom
Spring rope behaves correctly with mass 1. Set mass 5; same spring now sluggish or extreme.
What Causes This
Direct stiffness manipulation. If you computed spring k from scratch, k = m * (2 * pi * f)^2. Mass changes invalidate k.
Damping not in ratio form. Absolute damping similarly depends on mass.
The Fix
Step 1: Use Frequency and Damping Ratio.
// SpringJoint2D inspector
Frequency: 2.0 // 2 Hz oscillation
Damping Ratio: 0.5 // soft but settles
Distance: 3.0
These produce 2 Hz oscillation regardless of body mass.
Step 2: Code-set if needed.
var sj = GetComponent<SpringJoint2D>();
sj.frequency = 3f;
sj.dampingRatio = 0.7f;
Step 3: Match Damping Ratio to feel.
0.0: pure spring, oscillates forever
0.3-0.5: bouncy, visible wobble that settles
0.7-0.9: soft landing, 1-2 visible bumps
1.0: critical, fastest no-overshoot
>1.0: overdamped, sluggish approach
Step 4: For chains, weight matters. Chain of springs behaves like a single big spring; tune Frequency lower for floppy chains, higher for rigid ones.
Step 5: For runtime stability, avoid huge mass ratios. Bodies of mass 1 and 1000 connected by a spring stress the solver. Keep mass ratios under 100x where possible.
“Frequency + Damping Ratio. Mass-stable spring. Tune by feel.”
Related Issues
For DistanceJoint stretch, see DistanceJoint. For Effector forces, see Effector.
Frequency Hz, Damping Ratio. Mass-independent feel.