public sealed class FootPlacementPlants 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 PelvisThe joint that is moved to give the legs slack.
public ReadOnlySpan<FootChain> FeetThe legs.
public float MaxHipDropHow far the hips may be lowered, in metres.
public float AnkleWeightHow much of the way to the surface's normal the ankle rolls, in [0, 1].
public float WeightHow much of the placement to apply at all, in [0, 1].
Methods (2)
public FootPlacement(int pelvis, IEnumerable<FootChain> feet)Creates a solver for a character's legs.
public float Solve(Skeleton skeleton, Span<BoneTransform> local, Span<BoneTransform> model, ReadOnlySpan<GroundContact> contacts)Plants the feet.
Used by (2)
- ConstraintTestsVixen.Animation.Tests
- IkTestsVixen.Animation.Tests