# 1. Rigidbody Fundamentals
Part of [[Physics 3D]]. Next: [[2. Colliders and Physics Materials]].
**Docs:** [Introduction to rigid body physics](https://docs.unity3d.com/6000.5/Documentation/Manual/RigidbodiesOverview.html) · [Interpolation](https://docs.unity3d.com/6000.5/Documentation/Manual/rigidbody-interpolation.html) · [Collision detection modes](https://docs.unity3d.com/6000.5/Documentation/Manual/physics-optimization-cpu-rigidbody-collision-modes.html)
## 1.1 What a Rigidbody is
A **Rigidbody** tells PhysX to simulate the GameObject as a rigid body: forces, torque, gravity, collisions, joints. Prefer moving it with **physics APIs** (`AddForce`, `AddTorque`, velocity when appropriate) rather than writing `transform.position` every frame on a dynamic body — Transform writes fight the solver ([Manual](https://docs.unity3d.com/6000.5/Documentation/Manual/RigidbodiesOverview.html)).
Physics motion is computed in **world space**. Parenting still sets the initial local pose; simulation does not keep the body as a simple Transform child follower.
## 1.2 Core Inspector fields
| Field | Practical notes |
|---|---|
| **Mass** | Kilogram-ish units in a relative sense. Keep ratios sane (1 vs 1000 is harder than 1 vs 10). Vehicles like [[Car Controller]] often use ~1500. |
| **Drag / Angular Drag** | Linear / angular damping. Higher = settles faster; too high feels syrupy. |
| **Use Gravity** | Per-body gravity toggle. |
| **Is Kinematic** | Body is **not** force-driven; you drive Transform (or `MovePosition` / `MoveRotation`). Kinematic can push dynamic bodies; dynamic cannot push kinematic ([Manual](https://docs.unity3d.com/6000.5/Documentation/Manual/RigidbodiesOverview.html)). |
| **Interpolate** | Visual smoothing between physics steps — next section. |
| **Collision Detection** | Discrete vs Continuous family — section 1.4. |
| **Constraints** | Freeze position/rotation axes (2.5D, top-down, ragdoll partial locks). |
```csharp
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class RigidbodyBaseline : MonoBehaviour
{
[SerializeField] float mass = 1f;
[SerializeField] float drag = 0f;
[SerializeField] float angularDrag = 0.05f;
[SerializeField] bool useGravity = true;
[SerializeField] RigidbodyInterpolation interpolation = RigidbodyInterpolation.Interpolate;
[SerializeField] CollisionDetectionMode collisionMode = CollisionDetectionMode.Discrete;
Rigidbody _rb;
void Awake()
{
_rb = GetComponent<Rigidbody>();
_rb.mass = mass;
_rb.linearDamping = drag; // Unity 6 property name (was drag)
_rb.angularDamping = angularDrag; // Unity 6 property name (was angularDrag)
_rb.useGravity = useGravity;
_rb.interpolation = interpolation;
_rb.collisionDetectionMode = collisionMode;
}
}
```
> [!warning] Code not compiled in Unity
> Scripts in this series were **not** compiled in the Editor for this write-up. `linearDamping` / `angularDamping` / `linearVelocity` are the Unity 6000.5 Scripting API names (replacing obsolete `drag` / `angularDrag` / `velocity`).
## 1.3 Interpolation vs Extrapolate
Physics steps on the **Fixed Timestep** (`Edit > Project Settings > Time`). Rendering can run faster → visible jitter when a camera follows a Rigidbody.
| Mode | Behaviour | Prefer when |
|---|---|---|
| **None** | Default; pose jumps per physics tick | Static-ish bodies; no camera follow issue |
| **Interpolate** | Blend from previous poses; appears slightly **behind** | Variable velocity; other forces act on the body ([docs](https://docs.unity3d.com/6000.5/Documentation/Manual/rigidbody-interpolation.html)) |
| **Extrapolate** | Predict ahead from velocity; can **overshoot** collisions visually | Near-constant velocity, accuracy less critical |
When interpolation/extrapolation is on, PhysX owns the Transform. After any **direct** Transform write, call `Physics.SyncTransforms()` or the change can be ignored ([interpolation Manual](https://docs.unity3d.com/6000.5/Documentation/Manual/rigidbody-interpolation.html)).
Player capsules and camera targets: start with **Interpolate**.
## 1.4 Collision detection modes
From Unity's optimization Manual ([collision detection modes](https://docs.unity3d.com/6000.5/Documentation/Manual/physics-optimization-cpu-rigidbody-collision-modes.html)):
| Mode | Role | Cost |
|---|---|---|
| **Discrete** | Default; test at discrete steps | Cheapest; fast objects may **tunnel** |
| **Continuous Speculative** | Speculative CCD vs static + dynamic | Often best CCD balance — try this first when Discrete tunnels |
| **Continuous** | Sweep CCD vs **static** geometry | Heavier; not a guarantee vs other dynamics unless they use Continuous Dynamic |
| **Continuous Dynamic** | Sweep vs static + other Continuous/Continuous Dynamic dynamics | Highest CPU; last resort for critical pairs |
Recommended practice from that page: Discrete → Speculative if needed → Continuous → Continuous Dynamic only for critical object-object cases. **Profile.**
Projectiles, vehicles ([[Car Controller]]), and fast props are the usual CCD candidates.
## 1.5 Sleeping
Slow bodies drop below the **Sleep Threshold** and leave the active simulation until woken by force/collision ([Rigidbodies overview](https://docs.unity3d.com/6000.5/Documentation/Manual/RigidbodiesOverview.html)).
```csharp
using UnityEngine;
public class WakeOnDemand : MonoBehaviour
{
[SerializeField] Rigidbody target;
public void Nudge(Vector3 impulse)
{
if (target.IsSleeping())
target.WakeUp();
target.AddForce(impulse, ForceMode.Impulse);
}
}
```
Caveat from the Manual: bodies may **fail to wake** when only **static** colliders move via Transform. Prefer kinematic Rigidbodies for moving platforms, or call `WakeUp` when you cheat Transforms.
## 1.6 Ties to feel ([[Level Up! (Review)]])
Mass, drag, and fixed timestep are **feel knobs**. Document the values you ship (table in the design doc) the same way Level Up! pushes measurable tuning — do not leave "mass = 1 on everything" as an accident.
## Next
[[2. Colliders and Physics Materials]] — shapes and surface friction/bounce.