Tags: unity, joints, physics, hinge, spring, fixed, configurable, ragdoll, constraints, game-dev Last updated: 2026-06-27

Physics Joints & Constraints Cheatsheet

Quick Reference

Joint TypeMovementRotationBest For
FixedJointNoneNoneGlue two objects together (breakable)
HingeJointNone1 axisDoors, wheels, levers, pendulums
SpringJointStretchy connectionFreeBungee cords, elastic tethers
CharacterJointLimited all axesLimited all axesRagdolls, articulated limbs
ConfigurableJointFully customisableFully customisableAnything (most powerful)

FixedJoint

PropertyDescription
Connected BodyTarget Rigidbody to lock to
Break ForceForce threshold to break joint
Break TorqueTorque threshold to break joint
Enable CollisionAllow connected bodies to collide (usually false)
# Create breakable attachment
FixedJoint joint = gameObject.AddComponent<FixedJoint>();
joint.connectedBody = targetRigidbody;
joint.breakForce = 500f;
joint.breakTorque = 200f;

void OnJointBreak(float breakForce) {
    Debug.Log($"Joint broke at {breakForce}N");
}

HingeJoint

PropertyDescription
AxisRotation axis (local space)
AnchorPivot point (local space)
Use MotorApply rotational force
Motor Target VelocityTarget angular speed (deg/s)
Motor ForceTorque to reach target
Use LimitsRestrict rotation angle
Limits (min/max)Min/max angle in degrees
Use SpringSpring-back to target position
HingeJoint hinge = gameObject.AddComponent<HingeJoint>();
hinge.connectedBody = doorFrameRigidbody;

# Motor (spinning)
hinge.useMotor = true;
JointMotor motor = hinge.motor;
motor.targetVelocity = 360f;
motor.force = 100f;
hinge.motor = motor;

# Limits (door with 90° opening)
hinge.useLimits = true;
JointLimits limits = hinge.limits;
limits.min = 0f;
limits.max = 90f;
hinge.limits = limits;

# Spring (self-closing door)
hinge.useSpring = true;
JointSpring spring = hinge.spring;
spring.spring = 100f;
spring.damper = 10f;
spring.targetPosition = 0f;
hinge.spring = spring;

SpringJoint

PropertyDescription
SpringTension stiffness (higher = tighter)
DamperOscillation damping (higher = less bounce)
Min DistanceMinimum unstretched length
Max DistanceMaximum stretch length
SpringJoint spring = gameObject.AddComponent<SpringJoint>();
spring.connectedBody = targetRigidbody;
spring.spring = 50f;
spring.damper = 5f;
spring.minDistance = 0f;
spring.maxDistance = 3f;

CharacterJoint

PropertyDescription
Swing AxisPrimary rotation axis
Twist Limit SpringSpring for twist constraint
Low Twist LimitMin twist angle with bounciness
High Twist LimitMax twist angle with bounciness
Swing 1 LimitFirst swing axis (usually Y)
Swing 2 LimitSecond swing axis (usually Z)
Enable ProjectionSnap back if bodies separate too far

Ragdoll Setup

Step-by-Step

  1. Select the character’s bone hierarchy in the Hierarchy.
  2. GameObject → 3D Object → Ragdoll… (Unity wizard).
  3. Assign each bone: Pelvis, Spine, Head, Arms, Legs.
  4. Unity auto-adds CharacterJoints, Colliders, and Rigidbodies.
  5. Tune collider sizes to roughly match body parts.
  6. Tweak joint limits: Twist -20 to 20 (knees/elbows more restrictive), Swing -45 to 45 for most limbs.

Ragdoll Activation Script

public void EnableRagdoll() {
    foreach (Rigidbody rb in GetComponentsInChildren<Rigidbody>()) {
        rb.isKinematic = false;
        rb.useGravity = true;
    }
    foreach (Collider col in GetComponentsInChildren<Collider>())
        col.enabled = true;
    GetComponent<Animator>().enabled = false;
    GetComponent<Collider>().enabled = false;
    GetComponent<Rigidbody>().isKinematic = true;
}

public void DisableRagdoll() {
    foreach (Rigidbody rb in GetComponentsInChildren<Rigidbody>())
        rb.isKinematic = true;
    foreach (Collider col in GetComponentsInChildren<Collider>())
        col.enabled = false;
    GetComponent<Animator>().enabled = true;
    GetComponent<Collider>().enabled = true;
}

ConfigurableJoint

PropertyDescription
Connected BodyTarget Rigidbody
AnchorPivot in local space
AxisPrimary axis direction
X/Y/Z MotionLocked / Limited / Free
Angular X/Y/Z MotionLocked / Limited / Free
Target Position / VelocityDrives linear motion
Target Rotation / Angular VelocityDrives angular motion

Replicating Joint Types

Desired JointConfig
FixedJointAll Linear/Angular Motion = Locked
HingeJointAngular X Motion = Limited, rest = Locked
SpringJointLinear Y Motion = Limited (with spring)
ConfigurableJoint joint = gameObject.AddComponent<ConfigurableJoint>();
joint.connectedBody = targetRigidbody;

# Hinge-like
joint.angularXMotion = ConfigurableJointMotion.Limited;
joint.angularYMotion = ConfigurableJointMotion.Locked;
joint.angularZMotion = ConfigurableJointMotion.Locked;

SoftJointLimit limit = new SoftJointLimit();
limit.limit = 90f;
joint.angularXLimit = limit;

JointDrive drive = new JointDrive();
drive.positionSpring = 100f;
drive.positionDamper = 10f;
joint.angularXDrive = drive;

Joint Performance