Vixen
02b45cc4
csharp
public sealed class ConstraintStack

Every goal one character is under, resolved, arbitrated and applied to the pose after the layers have been mixed.

Read the guide page for this →

Remarks

An IPoseProcessor, because that hook already exists and already argues for itself. It runs after the layer mix and before skinning, with a model-space scratch buffer — which is exactly where a correction to the blended pose belongs, and is where the three existing IK solvers already are. They keep working beside this one, in whatever order the list gives.

Stateful, and one per character. That is not an implementation detail: every visible failure of a constraint system is a discontinuity, and almost all of them come from a goal appearing or disappearing between frames. A goal that becomes resolvable eases in from where the effector actually is; one that stops resolving — the entity unbound, the detail level dropped it, the clip blended out — eases out towards the animated pose using the last frame it saw, and does not vanish. Reset clears all of it, for a teleport or a cut, where continuity is wrong.

⚠ Its temporal state and its published pose are reachable from outside, on purpose. A scheduler that solves several characters together has to be able to read what each one is under and write what each one settled at, and a type whose state was private to itself could not have hosted that. This is the part of the shape that had to be decided before anything else depended on it.

Fields and properties (22)

  • public Skeleton Skeleton

    The skeleton being corrected.

  • public IConstraintArbiter Arbiter

    How conflicts resolve.

  • public IChainSolver Solver

    How a chain is moved.

  • public ConstraintBindings Bindings

    Who the other parties are.

  • public BoneTransform WorldTransform

    Where the character is, for bringing a world-space frame into the pose's space.

  • public byte Lod

    Which detail level is in force. Zero is the highest.

  • public int SolveEvery

    Solve every n-th frame, holding the previous correction in between.

  • public float Importance

    How much this character matters, for a governor deciding what to spend.

  • public int EstimatedCost

    Roughly what a full solve costs, in goals.

  • public bool WasHeld

    Whether the last frame held the previous correction rather than solving.

  • public BoneTransform RootSuggestion

    Where the character should stand, if anything asked.

  • public bool HasRootSuggestion

    Whether anything asked the character to stand somewhere else.

  • public ProxyShapes? Shapes

    The body's proxy shapes, or if it has none.

  • public AttachmentSockets Sockets

    The character's own attachment points.

  • public ConstraintTagBuffer? Tags

    Where a clip's live constraints are read from, or for none.

  • public int LastAppliedCount

    How many goals the last solve actually applied.

  • public ReadOnlySpan<ResolvedGoal> LastSolved

    The goals the last solve resolved, in the order the arbiter saw them.

  • public ReadOnlySpan<ConstraintResidual> LastResiduals

    How far off each of those ended up, in the same order.

  • public bool Scheduled

    Whether a scheduler has claimed this stack for a group solve, so the animator's own processor pass leaves it alone.

  • public Animator? Owner

    The animator this stack was found on, once a system has gathered it.

  • public ReadOnlySpan<BoneTransform> Published

    The pose a grouped pre-evaluation solve settled on, if one ran this frame.

  • public bool HasPublished

    Whether anything published this frame.

Methods (14)

Used by (24)

  • ConstraintStageBenchmarksVixen.Benchmarks.Animation
  • AnimationSystemVixen.Animation
  • CameraConstraintsVixen.Animation
  • ConstraintGizmoSystemVixen.Animation
  • ConstraintGizmosVixen.Animation
  • ConstraintGovernorVixen.Animation
  • ConstraintGroupVixen.Animation
  • ConstraintHandleVixen.Animation
  • ConstraintStageTestsVixen.Animation.Tests
  • ConstraintTestsVixen.Animation.Tests
  • DefaultConstraintSchedulerVixen.Animation
  • FootPlacementPresetVixen.Animation
  • GizmoTestsVixen.Animation.Tests
  • GroupSinkVixen.Animation
  • IConstraintGroupSinkVixen.Animation
  • IConstraintSchedulerVixen.Animation
  • JointLimitTestsVixen.Animation.Tests
  • OneGroupTestSchedulerVixen.Animation.Tests
  • PlacementTestsVixen.Animation.Tests
  • PlaybackVixen.Animation
  • ProxyShapeTestsVixen.Animation.Tests
  • SeamTestsVixen.Animation.Tests
  • TrajectoryTestsVixen.Animation.Tests
  • VariationHarnessVixen.Animation