Applying Procedural Pelvis Offsets for Balance
In this lesson, you will learn how to shift the character’s pelvis vertically to maintain a natural, balanced posture whenever the feet are positioned at different heights.
The Core Concept
When a character stands on uneven terrain, their legs extend or bend to reach the ground. If you only perform Foot IK (keeping the feet planted), the character’s torso often appears to "float" or sink unnaturally because the pelvis remains at its default height. To counter this, we apply a procedural offset to the pelvis bone. By calculating the average vertical displacement of both feet, we can shift the pelvis downward when the character is crouched or standing on slopes, ensuring the center of mass stays realistically distributed between the legs.
Implementing the Offset
Within your Control Rig, you can calculate the required offset by comparing the "target" height (where the feet want to be) against the "actual" height (where they currently are after Foot IK).
A simple approach is to calculate the average of the two foot offsets and apply a fraction of that value to the pelvis control. This prevents the pelvis from moving too drastically, which would look jittery:
// Logic inside Control Rig
float PelvisOffset = (LeftFootOffset + RightFootOffset) * 0.5f;
// Apply the offset to the Pelvis control
FVector CurrentPelvisPos = PelvisControl.GetTranslation();
PelvisControl.SetTranslation(CurrentPelvisPos + FVector(0, 0, PelvisOffset * BalanceFactor));
By multiplying the offset by a BalanceFactor (a float between 0 and 1), you can tune how much the body "dips" in response to the legs. If the value is too high, the character will look like they are collapsing; if too low, the legs will look unnaturally stretched.
This technique works in tandem with the Foot IK logic you already implemented. As the legs adjust to the uneven floor, the pelvis automatically tracks the "midpoint" of those adjustments, creating the illusion of weight and gravity acting upon the character's hips. This simple shift is the key to preventing the "floating" feet look common in basic animation systems.
Key Takeaway: By offsetting the pelvis by the average vertical displacement of the feet, you maintain a grounded center of mass that prevents the character from appearing to stretch or float on uneven terrain.