LOADING
加载中,请稍候…
ZC 程之睿 CZR's SPACE
AnimationIKUnrealEngine

预测性 Foot IK:让脚步先于地形,而不是踩空后再修正Predictive Foot IK: Anticipating Terrain Instead of Correcting After Contact

2026年7月1日July 1, 2026 7 分钟阅读7 min read 程之睿

大多数 Foot IK 教程做的是被动纠正:每帧向下 trace,把脚贴到地面。平地没问题,但在楼梯、斜坡、碎石上会出现两类瑕疵 —— 脚在半空短暂穿模,或贴地时机不对导致「滑步」。

问题:纠正是「滞后」的

被动方案的本质是「先播动画,再事后拉回」。脚已经按平地假设摆到了错误位置,我们才在后处理里强行拽回地面 —— 视觉上就是一帧抖动或滑动。

思路:把「落地时机」变成可预测的数据

  • FootPlantAlpha_L / _R:0→1 表示这只脚从摆动进入「计划落地」的程度;
  • FootState_L / _R:离散标记 planted / swinging。
float alpha = GetCurveValue("FootPlantAlpha_L");
FVector predicted = PredictFootTarget(LeftFootBone, alpha);
SetIKGoal(LeftFootGoal, predicted, alpha);

骨盆偏移别忘了

两只脚落在不同高度时,要把骨盆 (pelvis) 向下偏移到较低那只脚的水平,否则腿会被拉直穿模。

手 K 曲线「贵」,但换来的是确定性:落地时机不再依赖运行时的猜测。

Most foot-IK tutorials do passive correction: trace down every frame and snap the foot to the ground. Fine on flat ground — but on stairs, slopes, and rubble you get two artifacts: the foot briefly clips mid-air, or it plants at the wrong moment and "slides".

The problem: correction lags

The passive approach is "play the animation, then yank it back". The foot has already moved to a wrong position assuming flat ground, and only then do we drag it to the surface — a frame of jitter or sliding.

The idea: turn "plant timing" into predictable data

  • FootPlantAlpha_L / _R: 0→1 for how far a foot has moved from swing into "planned plant";
  • FootState_L / _R: discrete markers for planted / swinging.
float alpha = GetCurveValue("FootPlantAlpha_L");
FVector predicted = PredictFootTarget(LeftFootBone, alpha);
SetIKGoal(LeftFootGoal, predicted, alpha);

Don't forget the pelvis offset

When the two feet land at different heights, lower the pelvis toward the lower foot, or the leg gets straightened and clips.

Hand-authored curves are "expensive", but they buy determinism: plant timing no longer relies on a runtime guess.