public static class LookAtIkTurns a chain of joints to face a point: the head-tracking solver, and the aim solver.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Distributed down the chain, from the root outwards. Each joint turns towards the target by its own weight; the joints after it inherit the turn and have less left to do. That is why the joints must be listed parent-first and why each one's model transform is recomputed as the pass goes: a chest that has already turned 20° means the neck is starting from somewhere else than the pose said.
The clamp is against the animated pose, not against the parent. A limit expressed relative to the parent would let a character with a turned chest look 90° further than one without, which is not what a person authoring "the head may turn 70°" means. Measured against what the animation asked for, the limit is the same wherever the body is.
There is no smoothing here and that is deliberate. A look-at that snaps as the target moves is a target that is snapping; damping belongs to whatever decides where to look, which is the only place that knows whether the character is meant to be startled.
Methods (1)
public static void Solve(Skeleton skeleton, Span<BoneTransform> local, Span<BoneTransform> model, ReadOnlySpan<LookAtJoint> chain, Vector3 target, Vector3 forward = default(Vector3), float weight = 1)Turns a chain towards a point.
Used by (1)
- IkTestsVixen.Animation.Tests