DirectionalMixerState Class

Summary

[Pro-Only] An Animancer.AnimancerState which blends an array of other states together based on a two dimensional parameter and thresholds using Polar Gradient Band Interpolation.

This mixer type is similar to the 2D Freeform Directional Blend Type in Mecanim Blend Trees.
graph BT Type-->Base0["MixerState<Vector2>"] Base0-->Base1["ManualMixerState"] click Base1 "/animancer/api/Animancer/ManualMixerState" Base1-->Base2["MixerState"] click Base2 "/animancer/api/Animancer/MixerState" Base2-->Base3["AnimancerState"] click Base3 "/animancer/api/Animancer/AnimancerState" Base3-->Base4["AnimancerNode"] click Base4 "/animancer/api/Animancer/AnimancerNode" Base4-->Base5["Key"] click Base5 "/animancer/api/Animancer/Key" Base5-->Base6["Object"] Type-.->Interface0["IKeyHolder"] click Interface0 "/animancer/api/Animancer/IKeyHolder" Type-.->Interface1["IEnumerable<AnimancerState>"] Type-.->Interface2["IEnumerator"] Type-.->Interface3["IPlayableWrapper"] click Interface3 "/animancer/api/Animancer/IPlayableWrapper" Type-.->Interface4["IAnimationClipCollection"] click Interface4 "/animancer/api/Animancer/IAnimationClipCollection" Type["DirectionalMixerState"] class Type type-node

Syntax

public class DirectionalMixerState : MixerState<Vector2>, IKeyHolder, IEnumerable<AnimancerState>, 
    IEnumerator, IPlayableWrapper, IAnimationClipCollection

Fields

Name Constant Value Summary
DontSynchroniseChildren
An empty array used by Animancer.MixerState.SynchroniseChildren as a special value to indicate that no children should be synchronised (instead of needing a properly sized array containing all false values).
Inherited from MixerState
static
NoStates
An empty array of states.
Inherited from ManualMixerState
static

Properties

Name Value Summary
ApplyAnimatorIK bool
[Animancer.IHasIK] Determines whether OnAnimatorIK(int layerIndex) will be called on the animated object while this node is active. The initial value is determined by Animancer.AnimancerPlayable.DefaultApplyAnimatorIK.

This is equivalent to the "IK Pass" toggle in Animator Controller layers.

Note that this property only applies to Animancer.ClipStates.
Inherited from AnimancerNode
ApplyFootIK bool
[Animancer.IHasIK] Determines whether this node is applying IK to the character's feet. The initial value is determined by Animancer.AnimancerPlayable.DefaultApplyFootIK.

This is equivalent to the "Foot IK" toggle in Animator Controller states.
Inherited from AnimancerNode
AverageVelocity Vector3
The average velocity of the root motion caused by this state.
Inherited from MixerState
ChildCount int
The number of states using this mixer as their Animancer.AnimancerState.Parent.
Inherited from ManualMixerState
ChildStates IList<AnimancerState>
Returns the Animancer.ManualMixerState._States.
Inherited from ManualMixerState
Clip AnimationClip
An Animancer.MixerState has no UnityEngine.AnimationClip.
Inherited from MixerState
Duration float
The number of seconds the animation will take to play fully at its current Animancer.AnimancerNode.Speed.

Setting this value modifies the Animancer.AnimancerNode.Speed, not the Animancer.AnimancerState.Length. Animancer Lite does not allow this value to be changed in a runtime build.

For the time remaining from now until it reaches the end, use Animancer.AnimancerState.RemainingDuration instead.
Inherited from AnimancerState
EffectiveSpeed float
The Animancer.AnimancerNode.Speed of this node multiplied by the Animancer.AnimancerNode.Speed of each of its parents down the hierarchy (including the root Animancer.AnimancerPlayable.Speed) to determine the actual speed its output is being played at.
Inherited from AnimancerNode
EffectiveWeight float
The Animancer.AnimancerNode.Weight of this state multiplied by the Animancer.AnimancerNode.Weight of each of its parents down the hierarchy to determine how much this state affects the final output.
Inherited from AnimancerState
EventPoolCapacity int
The capacity of the internal list in the Animancer.ObjectPool`1 for Animancer.AnimancerState.EventRunner.
Inherited from AnimancerState
static
EventPoolCount int
The number of spare items in the Animancer.ObjectPool`1 for Animancer.AnimancerState.EventRunner.
Inherited from AnimancerState
static
Events AnimancerEvent.Sequence
A list of Animancer.AnimancerEvents that will occur while this state plays as well as one that specifically defines when this state ends.

Accessing this property will acquire a spare Animancer.AnimancerEvent.Sequence from the Animancer.ObjectPool if none was already assigned. You can use Animancer.AnimancerState.HasEvents to check beforehand.

Animancer Lite does not allow the use of events in a runtime build, except for Animancer.AnimancerEvent.Sequence.OnEnd.
Inherited from AnimancerState
FadeSpeed float
The speed at which this node is fading towards the Animancer.AnimancerNode.TargetWeight.
Inherited from AnimancerNode
HasEvents bool
Indicates whether this state currently has an Animancer.AnimancerEvent.Sequence (since accessing the Animancer.AnimancerState.Events would automatically get one from the Animancer.ObjectPool).
Inherited from AnimancerState
Index int
The index of the port this node is connected to on the parent's UnityEngine.Playables.Playable.

A negative value indicates that it is not assigned to a port.
Inherited from AnimancerNode
IsActive bool
Returns true if this state is playing and is at or fading towards a non-zero Animancer.AnimancerNode.Weight.
Inherited from AnimancerState
IsLooping bool
Returns true if any child state is looping.
Inherited from MixerState
IsPlaying bool
Determines whether the states in this mixer are playing.
Inherited from MixerState
IsStopped bool
Returns true if this state is not playing and is at 0 Animancer.AnimancerNode.Weight.
Inherited from AnimancerState
IsValid bool
Indicates whether the Animancer.AnimancerNode._Playable is usable (properly initialised and not destroyed).
Inherited from AnimancerNode
KeepChildrenConnected bool
Mixers should keep child playables connected to the graph at all times.
Inherited from MixerState
Key Object
The object used to identify this state in the root Animancer.AnimancerPlayable.States dictionary. Can be null.
Inherited from AnimancerState
Layer AnimancerLayer
The root Animancer.AnimancerLayer which this state is connected to.
Inherited from AnimancerState
LayerIndex int
The index of the Animancer.AnimancerLayer this state is connected to (determined by the Animancer.AnimancerState.Parent).
Inherited from AnimancerState
Length float
The weighted average Animancer.AnimancerState.Length of each child state according to their Animancer.AnimancerNode.Weight.
Inherited from MixerState
MainObject Object
The main object to show in the Inspector for this state (if any).
Inherited from AnimancerState
Name string
[Editor-Only] The Inspector display name of this node.
Inherited from AnimancerNode
NormalizedTime float
The Animancer.AnimancerState.Time of this state as a portion of the animation's Animancer.AnimancerState.Length, meaning the value goes from 0 to 1 as it plays from start to end, regardless of how long that actually takes.

This value will continue increasing after the animation passes the end of its Animancer.AnimancerState.Length while the animated object either freezes in place or starts again from the beginning according to whether it is looping or not.

The fractional part of the value (NormalizedTime % 1) is the percentage (0-1) of progress in the current loop while the integer part ((int)NormalizedTime) is the number of times the animation has been looped.

Animancer Lite does not allow this value to be changed to a value other than 0 in a runtime build.
Inherited from AnimancerState
ParameterCount int
The number of parameters being managed by this state.
ParameterX float
Gets or sets Parameter.x.
ParameterY float
Gets or sets Parameter.y.
Parent IPlayableWrapper
The object which receives the output of the UnityEngine.Playables.Playable.
Inherited from AnimancerState
RawTime float
The weighted average Animancer.AnimancerState.Time of each child state according to their Animancer.AnimancerNode.Weight.
Inherited from MixerState
RemainingDuration float
The number of seconds the animation will take to reach the end at its current Animancer.AnimancerNode.Speed.

Setting this value modifies the Animancer.AnimancerNode.Speed, not the Animancer.AnimancerState.Length. Animancer Lite does not allow this value to be changed in a runtime build.

For the time it would take to play fully from the start, use Animancer.AnimancerState.Duration instead.
Inherited from AnimancerState
Root AnimancerPlayable
The Animancer.AnimancerPlayable at the root of the graph.
Inherited from AnimancerNode
Speed float
[Pro-Only] How fast the Animancer.AnimancerState.Time is advancing every frame.

1 is the normal speed.

A negative value will play the animation backwards.
Inherited from AnimancerNode
SynchroniseChildren bool[]
Indicates which children should have their Animancer.AnimancerNode.Speed modified in order to keep their Animancer.AnimancerState.NormalizedTime at approximately the same value.

The array can be null or empty. Any elements not in the array will be treated as true.
Inherited from MixerState
TargetWeight float
The desired Animancer.AnimancerNode.Weight which this node is fading towards according to the Animancer.AnimancerNode.FadeSpeed.
Inherited from AnimancerNode
Time float
The number of seconds that have passed since the start of this animation.

This value will continue increasing after the animation passes the end of its Animancer.AnimancerState.Length while the animated object either freezes in place or starts again from the beginning according to whether it is looping or not.

Animancer Lite does not allow this value to be changed in a runtime build (except resetting it to 0).
Inherited from AnimancerState
Weight float
The current blend weight of this node which determines how much it affects the final output. 0 has no effect while 1 applies the full effect of this node and values inbetween apply a proportional effect.

Setting this property cancels any fade currently in progress. If you don't wish to do that, you can use Animancer.AnimancerNode.SetWeight(System.Single) instead.

Animancer Lite only allows this value to be set to 0 or 1 in a runtime build.
Inherited from AnimancerNode
WeightsAreDirty bool
Indicates whether the weights of all child states should be recalculated.
Inherited from MixerState

Methods

Name Value Summary
AppendDescription(StringBuilder, int, string) void
Appends a detailed descrption of the current details of this node.
Inherited from AnimancerNode
AppendParameter(StringBuilder, Vector2) void
Appends the `parameter` in a viewer-friendly format.
ApplySynchroniseChildren(bool) void
Applies the effects of Animancer.MixerState.SynchroniseChildren.
Inherited from MixerState
CalculateTotalChildWeight() float
Calculates the sum of the Animancer.AnimancerNode.Weight of all child states.
Inherited from MixerState
CancelSetTime() void
Prevents the Animancer.AnimancerState.RawTime from being applied.
Inherited from AnimancerState
ChangeMainObject<T>(T, T) void
Sets the `currentObject` and calls Animancer.AnimancerNode.RecreatePlayable. If the `currentObject` was being used as the Animancer.AnimancerState.Key then it is changed as well.
Inherited from AnimancerState
CreateChild(int, AnimationClip) ClipState
Creates and returns a new Animancer.ClipState to play the `clip` with this mixer as its parent.
Inherited from MixerState
CreateChild(int, ITransition) AnimancerState
Calls Animancer.AnimancerUtilities.CreateStateAndApply(Animancer.ITransition,Animancer.AnimancerPlayable) and sets this mixer as the state's parent.
Inherited from MixerState
CreatePlayable() void
Creates and assigns the UnityEngine.Playables.Playable managed by this node.
Inherited from AnimancerNode
CreatePlayable(Playable) void
Creates and assigns the UnityEngine.Playables.Playable managed by this node.
Inherited from MixerState
CreatePlayable<T>(AnimancerPlayable, T, bool) AnimationScriptPlayable
Creates an AnimationScriptPlayable to run the specified Animation Job instead of the usual UnityEngine.Animations.AnimationMixerPlayable.
Inherited from MixerState
CreatePlayable<T>(Playable, T, bool) void
Creates an AnimationScriptPlayable to run the specified Animation Job instead of the usual UnityEngine.Animations.AnimationMixerPlayable.
Inherited from MixerState
Destroy() void
Destroys the UnityEngine.Playables.Playable and cleans up this state and its children.
Inherited from MixerState
DestroyChildren() void
Destroys all Animancer.MixerState.ChildStates connected to this mixer. This operation cannot be undone.
Inherited from MixerState
DestroyPlayable() void
Destroys the UnityEngine.Playables.Playable.
Inherited from AnimancerNode
DisableRemainingStates(int) void
Sets the weight of all states after the `previousIndex` to 0.
Inherited from MixerState
ForceRecalculateWeights() void
Recalculates the weights of all Animancer.ManualMixerState._States based on the current value of the Animancer.MixerState`1.Parameter and the thresholds.
GatherAnimationClips(ICollection<AnimationClip>) void
[Animancer.IAnimationClipCollection] Gathers all the animations in this state.
Inherited from MixerState
GetChild(int) AnimancerState
Returns the state connected to the specified `index` as a child of this mixer.
Inherited from ManualMixerState
GetDescription(int, string) string
Returns a detailed descrption of the current details of this node.
Inherited from AnimancerNode
GetEnumerator() IEnumerator<AnimancerState>
Returns an enumerator which will iterate through each state connected to this mixer.
Inherited from MixerState
GetJobData<T>() T
Gets the Animation Job data from the AnimationScriptPlayable.
Inherited from MixerState
GetNextState(int) AnimancerState
Returns the state at the specified `index` if it is not null, otherwise increments the index and checks again. Returns null if no state is found by the end of the Animancer.MixerState.ChildStates.
Inherited from MixerState
GetParameterName(int) string
Returns the name of a parameter being managed by this state.
GetParameterType(int) AnimatorControllerParameterType
Returns the type of a parameter being managed by this state.
GetParameterValue(int) Object
Returns the value of a parameter being managed by this state.
GetPath() string
Returns the hierarchy path of this state through its Animancer.AnimancerState.Parents.
Inherited from AnimancerState
IndexOf(Key) int
Returns location of this object in the list (or -1 if it is not currently in a keyed list).
Inherited from Key
static
Initialise(AnimationClip[]) void
Initialises this mixer with one state per clip.
Inherited from ManualMixerState
IsInList(Key) bool
Indicates whether the specified object is currently in a keyed list.
Inherited from Key
static
NormalizeDurations() void
Recalculates the Animancer.AnimancerState.Duration of all child states so that they add up to 1.
Inherited from MixerState
NormalizeWeights(float) void
Divides the weight of all states by the `totalWeight` so that they all add up to 1.
Inherited from MixerState
OnAddChild(IList<AnimancerState>, AnimancerState) void
Connects the `state` to this node at its Animancer.AnimancerNode.Index.
Inherited from AnimancerNode
OnThresholdsChanged() void
Called whenever the thresholds are changed. Indicates that the internal blend factors need to be recalculated and calls Animancer.DirectionalMixerState.ForceRecalculateWeights.
Play() void
Plays this animation immediately, without any blending. Sets Animancer.AnimancerState.IsPlaying = true, Animancer.AnimancerNode.Weight = 1, and clears the Animancer.AnimancerState.Events.

This method does not change the Animancer.AnimancerState.Time so it will continue from its current value.
Inherited from AnimancerState
RecalculateWeights() bool
If Animancer.MixerState.WeightsAreDirty this method recalculates the weights of all child states and returns true.
Inherited from MixerState
RecreatePlayableRecursive() void
Calls Animancer.AnimancerNode.RecreatePlayable on this node and all its children recursively.
Inherited from AnimancerNode
RequireUpdate() void
Calls Animancer.AnimancerPlayable.RequireUpdate(Animancer.AnimancerNode) as long as the Animancer.AnimancerNode.Root is not null.
Inherited from AnimancerNode
SetChild(int, AnimancerState) void
Assigns the `state` as a child of this mixer.
Inherited from MixerState
SetChildrenTime(float, bool) void
Sets Animancer.AnimancerState.Time for all Animancer.MixerState.ChildStates.
Inherited from MixerState
SetJobData<T>(T) void
Sets the Animation Job data in the AnimationScriptPlayable.
Inherited from MixerState
SetMinEventPoolCount(int) void
If the Animancer.AnimancerState.EventPoolCount is less than the specified value, this method increases it to that value by creating new objects.
Inherited from AnimancerState
static
SetName(string) void
[Editor-Conditional] Sets the Inspector display name of this node. Animancer.AnimancerNode.ToString returns the name.
Inherited from AnimancerNode
SetParameterValue(int, Object) void
Sets the value of a parameter being managed by this state.
SetParent(AnimancerNode, int) void
Connects this state to the `parent` mixer at the specified `index`.

See also Animancer.AnimancerLayer.AddChild(Animancer.AnimancerState) to connect a state to an available port on a layer.
Inherited from AnimancerState
SetRoot(AnimancerPlayable) void
The Animancer.AnimancerPlayable at the root of the graph.
Inherited from AnimancerState
SetWeight(float) void
Sets the current blend weight of this node which determines how much it affects the final output. 0 has no effect while 1 applies the full effect of this node.

This method allows any fade currently in progress to continue. If you don't wish to do that, you can set the Animancer.AnimancerNode.Weight property instead.

Animancer Lite only allows this value to be set to 0 or 1 in a runtime build.
Inherited from AnimancerNode
StartFade(float, float) void
Calls Animancer.AnimancerNode.OnStartFade and starts fading the Animancer.AnimancerNode.Weight over the course of the `fadeDuration` (in seconds).

If the `targetWeight` is 0 then Animancer.AnimancerNode.Stop will be called when the fade is complete.

If the Animancer.AnimancerNode.Weight is already equal to the `targetWeight` then the fade will end immediately.

Animancer Lite only allows a `targetWeight` of 0 or 1 and the default `fadeDuration` in a runtime build.
Inherited from AnimancerNode
Stop() void
Stops the animation and makes it inactive immediately so it no longer affects the output. Sets Animancer.AnimancerNode.Weight = 0, Animancer.AnimancerState.IsPlaying = false, Animancer.AnimancerState.Time = 0, and clears the Animancer.AnimancerState.Events.

If you only want to freeze the animation in place, you can set Animancer.AnimancerState.IsPlaying = false instead. Or to freeze all animations, you can call Animancer.AnimancerPlayable.PauseGraph.
Inherited from AnimancerState
ToString() string
Returns a string describing the type of this mixer and the name of Animancer.MixerState.Clips connected to it.
Inherited from MixerState

Extension Methods

Name Value Summary
CalculateEditorFadeDuration(float) float
Returns the duration of the `node`s current fade (if any), otherwise returns the `defaultDuration`.
CalculateThresholdsFromAverageVelocityXZ() void
[Pro-Only] Calculates all thresholds in the `mixer` using the Animancer.AnimancerState.AverageVelocity of each state on the X and Z axes.

Note that this method requires the Root Transform Position (XZ) -> Bake Into Pose toggle to be disabled in the Import Settings of each UnityEngine.AnimationClip in the mixer.
IsValid() bool
Returns true if the `node` is not null and Animancer.AnimancerNode.IsValid.