public sealed class StateMachineInstanceOne character's position in a state machine: which state, how far through, and whatever it is still fading out of.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Playback is a stack of states, not a current-and-next pair. A transition pushes its destination on top and fades it in; the states below keep playing and keep their own time. When the top reaches full weight everything under it is dropped.
That is the design that makes interruption fall out rather than be bolted on. A transition interrupted halfway is a third state pushed on top of two that are already blending, and it fades in over the blend they were producing — which is exactly what a person means by "interrupt": what was on screen keeps being on screen, and the new thing arrives over it. The alternative, snapshotting the blended pose and fading from a frozen copy, is cheaper and produces a visible hitch: the pose the player was looking at stops moving at the moment the new input lands.
The stack is capped at MaxConcurrentStates. Past that the cost is real — each entry is a full motion evaluation — and the contribution of the oldest is under a percent by construction, so it is dropped rather than blended.
Fields and properties (9)
public const int MaxConcurrentStatesHow many states may be blending at once before the oldest is dropped.
public AnimationStateMachine MachineThe graph being run.
public ConstraintTagBuffer? ConstraintsWhere the clips it plays report their constraint tags, or to report none.
public int CurrentStateWhich state is on top — the one transitions are evaluated from.
public string CurrentStateNameWhat it is called.
public float NormalizedTimeHow far through the current state playback is, as a fraction of its length.
public bool IsTransitioningWhether anything is still fading out underneath the current state.
public float TransitionProgressHow far the current transition has got, in [0, 1].
public int ActiveStateCountHow many states are blending.
Methods (4)
public StateMachineInstance(AnimationStateMachine machine, AnimationParameters parameters, PoseScratch scratch)Starts a character in a machine's default state.
public void Play(int state, float crossfade = 0, float offset = 0)Goes to a state, whatever the graph says.
public bool Play(string state, float crossfade = 0, float offset = 0)Goes to a state by name, whatever the graph says.
public RootMotionDelta Evaluate(float deltaTime, Span<BoneTransform> destination, AnimationEventBuffer? events, int layer, float weight, bool wantsRootMotion)Advances playback and poses the skeleton.
Used by (8)
- AnimationLayerVixen.Animation
- AnimatorVixen.Animation
- AnimatorTestsVixen.Animation.Tests
- NetworkAnimatorApplySystemVixen.Net.Animation
- NetworkAnimatorCaptureSystemVixen.Net.Animation
- NetworkAnimatorTestsVixen.Net.Animation.Tests
- StateMachineTestsVixen.Animation.Tests
- AnimationGraphTestsVixen.Editor.AnimationGraph.Tests