Vixen
02b45cc4
csharp
public sealed class FootPlacement

Plants feet on ground the animation did not know about: drop the hips until the lowest foot can reach, then solve each leg to its own contact and roll the ankle onto the slope.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The hips move first, and that is the whole of why this is not just two two-bone solves. A character standing on a slope has one foot lower than the other by more than a leg can stretch; solving each leg on its own straightens the low one and leaves the character floating with a locked knee. Lowering the pelvis by the deepest foot's shortfall gives both legs slack, and both then solve with a bend.

Only ever down. Raising the hips to meet a foot that is above the animated pose would lift the character off the ground it is standing on — the animation already put the supporting foot where it should be, and the other foot's contact is the one that has to give. So the offset is the minimum over the feet, clamped at zero above and at MaxHipDrop below.

Ankle roll is a rotation towards the surface normal, weighted. Full alignment on a steep slope puts the toe through the ground; the weight is what an artist tunes, and the default of 1 is right for the gentle slopes this is mostly used on.

Fields and properties (5)

  • public int Pelvis

    The joint that is moved to give the legs slack.

  • public ReadOnlySpan<FootChain> Feet

    The legs.

  • public float MaxHipDrop

    How far the hips may be lowered, in metres.

  • public float AnkleWeight

    How much of the way to the surface's normal the ankle rolls, in [0, 1].

  • public float Weight

    How much of the placement to apply at all, in [0, 1].

Methods (2)

Used by (2)

  • ConstraintTestsVixen.Animation.Tests
  • IkTestsVixen.Animation.Tests