Gamedev Hub

PD & SPD Controllers (Stable Physics Tracking)

Controlling physics objects with raw forces often leads to jitter, overshoot, and “explosions.” PD Controllers (Proportional-Derivative) and their advanced cousin SPD (Stable Proportional Derivative) are the industry standard for making physics bodies follow targets—essential for VR hands, active ragdolls, and networked physics.

1. The PD Controller Formula

A PD controller is a feedback loop that calculates the necessary force to reach a target: Force = (PositionError * kP) + (VelocityError * kD)

2. SPD: The “Black Magic” of Stability

Traditional PD controllers can become unstable at high spring strengths or low framerates. SPD (Stable Proportional Derivative), introduced by Jie Tan, makes the controller implicit. It effectively calculates the force based on the predicted state of the next frame, making it nearly impossible to “explode.”

3. VR Physics Hands

This is the core of high-end VR interaction (like Boneworks or Half-Life: Alyx).

4. Networking: Physics Syncing

Instead of teleporting a player’s position (which breaks physics and causes jitter), you can sync the Target Transform and use a PD controller locally to drive the actual Rigidbody.

5. Implementation (C# Example)

public class PDController : MonoBehaviour {
    public float kP = 1000f; // Spring
    public float kD = 100f;  // Damper
    public Transform target;
    private Rigidbody rb;

    void FixedUpdate() {
        Vector3 posError = target.position - transform.position;
        Vector3 velError = (target.position - lastTargetPos) / Time.fixedDeltaTime - rb.linearVelocity;
        
        Vector3 force = (posError * kP) + (velError * kD);
        rb.AddForce(force);

        lastTargetPos = target.position;
    }
}

6. References & Deep Dives

Summary