# 4. Joints
Part of [[Physics 3D]]. Previous: [[3. Layers Matrix and Queries]]. Next: [[5. Forces FixedUpdate and Motion Modes]].
**Docs:** [Introduction to joints](https://docs.unity3d.com/6000.5/Documentation/Manual/Joints.html) · [Fixed Joint](https://docs.unity.com/en-us/engine/6000.5/manual/physics-section/physics-overview/joints-section/class-fixed-joint)
## 4.1 What joints do
A joint connects a Rigidbody to **another Rigidbody** or to a **fixed point in world space**. Joints apply constraint forces and optional limits; they are **not** the same as Transform parenting ([Joints intro](https://docs.unity3d.com/6000.5/Documentation/Manual/Joints.html)).
If you need industrial kinematic chains (robot arms with articulation drives), Unity points you at **ArticulationBody** instead of classic joints — out of scope for this part, but do not force ConfigurableJoint into that job.
## 4.2 Joint menu
| Component | Behaviour |
|---|---|
| **Fixed Joint** | Glue two bodies (or body → world). Good for breakable welds (`Break Force` / `Break Torque`). |
| **Hinge Joint** | Rotate around one axis — doors, lids, fingers. |
| **Spring Joint** | Elastic tether keeping anchors near a rest distance. |
| **Character Joint** | Ball-and-socket style (ragdoll limbs). |
| **Configurable Joint** | Fully general DOF locks, limits, drives — powerful and easy to destabilize. |
Shared ideas: **Connected Body**, anchors, break thresholds, `Enable Collision` between connected bodies, mass scale helpers when masses differ wildly (see Fixed Joint reference).
## 4.3 Fixed Joint — breakable prop weld
```csharp
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class BreakableWeld : MonoBehaviour
{
[SerializeField] Rigidbody connected;
[SerializeField] float breakForce = 500f;
[SerializeField] float breakTorque = 500f;
void Awake()
{
var joint = gameObject.AddComponent<FixedJoint>();
joint.connectedBody = connected; // null = world
joint.breakForce = breakForce;
joint.breakTorque = breakTorque;
}
void OnJointBreak(float breakForceApplied)
{
Debug.Log(
quot;{name} weld broke with force {breakForceApplied}", this);
}
}
```
> [!warning] Code not compiled in Unity
> Not compiled in Editor for this write-up.
## 4.4 Hinge Joint — simple door
```csharp
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class DoorHingeSetup : MonoBehaviour
{
[SerializeField] Vector3 anchorLocal = Vector3.zero;
[SerializeField] Vector3 axisLocal = Vector3.up;
[SerializeField] float spring = 0f;
[SerializeField] float damper = 0f;
[SerializeField] float targetAngle = 0f;
void Awake()
{
var rb = GetComponent<Rigidbody>();
rb.interpolation = RigidbodyInterpolation.Interpolate;
var hinge = gameObject.AddComponent<HingeJoint>();
hinge.anchor = anchorLocal;
hinge.axis = axisLocal;
hinge.useSpring = spring > 0f || damper > 0f;
if (hinge.useSpring)
{
hinge.spring = new JointSpring
{
spring = spring,
damper = damper,
targetPosition = targetAngle
};
}
hinge.useLimits = true;
hinge.limits = new JointLimits { min = -10f, max = 90f };
}
}
```
> [!warning] Code not compiled in Unity
> Not compiled in Editor for this write-up. Tune anchors in Scene view gizmo after spawn.
## 4.5 Stability tips
- Connected bodies with **huge mass ratios** fight the solver — use **Mass Scale** / **Connected Mass Scale** on joints when needed (Fixed Joint docs).
- Do not mix constant Transform teleporting on a jointed dynamic body.
- Kinematic connected body: joint can move the **non-kinematic** partner to satisfy constraints; it will not force the kinematic body ([Rigidbody intro](https://docs.unity3d.com/6000.5/Documentation/Manual/RigidbodiesOverview.html)).
- Ragdolls: Character/Configurable joints + careful layer matrix so limbs do not explode against world colliders on spawn.
## 4.6 Design note
Breakable joints are juice — [[Level Up! (Review)]] "feel" applies: telegraph weak welds, audio on `OnJointBreak`, avoid random breaks from tiny player bumps (threshold tuning).
## Next
[[5. Forces FixedUpdate and Motion Modes]] — how you actually drive bodies each tick.