Summary
A type of layer playing one or more animation clips via a
PlayableGraph
.
Controlling an animation is mainly done with an instance of that class.
Syntax
public class FlexMotionLayer
Fields
Name | Field Type | Summary |
---|---|---|
BlendPositions | float[] |
The array of corresponding blend positions for each animation clip. Used for 1D blending. Not used if the layer has only one animation clip.
|
BlendRange | Vector2 |
The start and end range used during blending. For 1D blending, this value is ignored if the Blend Positions has been set.
|
Properties
Name | Property Type | Summary |
---|---|---|
AngularVelocity | Vector3 |
Get the root motion angular velocity of the animations played by that layer.
Should be typically accessed from an OnAnimatorMove callback.
|
ClipCount | int |
The number of AnimationClips being played by the
FlexMotionLayer .
|
CurrentState | FlexMotionLayer |
The state of the
FlexMotionLayer .
|
IsInPose | bool |
Determines if the FlexMotionLayer is currently posing.
Posing a layer can be seen as a pause that doesn't prevent transitions to occur.
|
IsInTransition | bool |
Checks the current state of the layer to determine if it's in or out transition.
|
IsMirror | bool |
Determines whether or not the pose should be mirrored.
|
IsPaused | bool |
Determines if the underlying
FlexMotionMaskLayer is paused or not.
It's important to note that if paused, transitions will be paused as well.
|
IsPlaying | bool |
Determines whether the
FlexMotionLayer is playing (including transitions).
|
Length | float |
The scaled length in seconds of the longest
AnimationClip .
|
NormalizedTime | float |
Computes the current animation progress ratio using the longest
AnimationClip . The returns value is not clamped and will eventually be above 1.0f even if the clip doesn't loop.
|
Speed | float |
The speed multiplier of the Layer.
|
Time | float |
Gets the layer's current animation time.
|
UnscaledLength | float |
The unscaled length in seconds of the
FlexMotionLayer based on the longest AnimationClip .
|
UseWeightedLengths | bool |
Should the layer recompute every clip speed value using their weights?
This will be done every frame to achieve a consistent length.
|
Velocity | Vector3 |
Get the root motion velocity of the animations played by that layer.
Should be typically accessed from an OnAnimatorMove callback.
|
Weight | float |
The weight of the motion layer used for blending.
|
Methods
Name | Return Value | Summary |
---|---|---|
ClearRootMotion |
FlexMotionLayer |
Clear root motion data by reapplying the current time to the playable.
|
Compute1dBlendWeight |
void |
Computes 1D blend weights based on the given value and previously provided blend positions.
|
Compute2dBlendWeight |
void |
Computes 2D blend weights based on the given value.
|
Compute |
FlexMotionLayer |
Ensures that the AnimationClips have the same playback length by computing
the speed of their respective AnimationClipPlayable using the average clip length.
|
Compute |
void |
Computes 1D blend weights based on the given value.
|
DeleteAnimationJob |
void |
Delete the AnimationScriptPlayable from a previously inserted animation job.
|
GetAnimationAsset |
object |
The reference to the FlexMotion or AnimationClip asset that was lastly used on that layer.
|
GetAnimationClip |
AnimationClip |
Determines the currently shown animation clip based on the layer's weights.
Playing an animation clip or a FlexMotion asset with only one clip will skip the weight check.
|
InsertAnimationJob |
Animation |
Insert an Animation Job that will only affect that animation layer.
This will create an AnimationScriptPlayable and insert it into the PlayableGraph.
|
IsReusable |
bool |
Determines if the layer is reusable without having to create and connect new Playables.
|
OnComplete |
FlexMotionLayer |
Subscribes a callback to the completed event which is triggered when the time crosses the current length.
The callback will be invoked once per loop even if the animation is visually not looping.
Please consider using
OnComplete<T>(T, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
OnComplete |
FlexMotionLayer |
Register a callback that will be invoked when the time crosses the current length.
The callback will be invoked once per loop even if the animation is visually not looping.
|
OnNormalizedTime |
FlexMotionLayer |
Registers a callback that will be invoked once when the provided normalized time is reached.
Please consider using
OnNormalizedTime<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
OnNormalizedTime |
FlexMotionLayer |
Registers a callback that will be invoked when the provided normalized time is reached.
Please consider using
OnNormalizedTime<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
OnNormalizedTime |
FlexMotionLayer |
Registers a callback that will be invoked once when the provided normalized time is reached.
|
OnNormalizedTime |
FlexMotionLayer |
Registers a callback that will be invoked when the provided normalized time is reached.
|
OnNormalizedTimeLoop |
FlexMotionLayer |
Registers a callback that will be invoked when the provided normalized time is reached.
The process will be repeated for every subsequent loop (e.g.: 0.25 => 1.25 => 2.25...).
Please consider using
OnNormalizedTimeLoop<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
OnNormalizedTimeLoop |
FlexMotionLayer |
Registers a callback that will be invoked when the provided normalized time is reached.
The process will be repeated for every subsequent loop (e.g.: 0.25 => 1.25 => 2.25...).
|
On |
FlexMotionLayer |
Registers a callback that will be invoked when the provided normalized time is reached.
The process will be repeated for every subsequent added target time (e.g.: 0.25 => 0.50 => 0.75...).
Please consider using
OnNormalizedTimeRepeat<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
On |
FlexMotionLayer |
Registers a callback that will be invoked when the provided normalized time is reached.
The process will be repeated for every subsequent added target time (e.g.: 0.25 => 0.50 => 0.75...).
|
OnStopped |
FlexMotionLayer |
Subscribes a callback to the stopped event which is triggered when the layer starts its "out" transition.
Please consider using
OnStopped<T>(T, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
OnStopped |
FlexMotionLayer |
Register a callback that will be invoked when the layer starts its "out" transition.
|
OnTime |
FlexMotionLayer |
Registers a callback that will be invoked once when the provided time is reached.
Please consider using
OnTime<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
OnTime |
FlexMotionLayer |
Registers a callback that will be invoked when the provided time is reached.
Please consider using
OnTime<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
OnTime |
FlexMotionLayer |
Registers a callback that will be invoked once when the provided time is reached.
|
OnTime |
FlexMotionLayer |
Registers a callback that will be invoked when the provided time is reached.
|
OnTimeLoop |
FlexMotionLayer |
Registers a callback that will be invoked when the provided time is reached.
The process will be repeated for every subsequent loop (e.g.: 0.25 => 1.25 => 2.25...).
Please consider using
OnTimeLoop<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
OnTimeLoop |
FlexMotionLayer |
Registers a callback that will be invoked when the provided time is reached.
The process will be repeated for every subsequent loop (e.g.: 0.25 => 1.25 => 2.25...).
|
OnTimeRepeat |
FlexMotionLayer |
Registers a callback that will be invoked when the provided time is reached.
The process will be repeated for every subsequent added target time (e.g.: 0.25 => 0.50 => 0.75...).
Please consider using
OnTimeRepeat<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
OnTimeRepeat |
FlexMotionLayer |
Registers a callback that will be invoked when the provided time is reached.
The process will be repeated for every subsequent added target time (e.g.: 0.25 => 0.50 => 0.75...).
|
OnUpdate |
FlexMotionLayer |
Registers a callback that will be invoked once every update.
Please consider using
OnUpdate<T>(T, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
OnUpdate |
FlexMotionLayer |
Registers a callback that will be invoked once every update.
|
Pause |
void |
Pause the the underlying
FlexMotionMaskLayer .
It's important to note that if paused, transitions will be paused as well.
|
Play |
void |
Play the layer, starting its in transition. |
ResetClipLengths |
FlexMotionLayer |
Re-initializes the speed of every AnimationClipPlayables to 1f.
Thus the animation clips will have their original lengths restored.
Only useful to revert the effect of the method
EqualizeClipsLength .
|
Restore |
FlexMotionLayer |
Restores all the settings to their default values as if the
FlexMotionLayer has just been created or reused.
|
SetApplyFootIK |
FlexMotionLayer |
Sets the foot IK on or off for all AnimationClips.
|
SetApplyPlayableIK |
FlexMotionLayer |
Sets the playable IK on or off for all AnimationClips.
Setting it to turn enables the usage of the
OnAnimatorIk messages in MonoBehavior scripts.
|
SetBlendPositions |
FlexMotionLayer |
Sets the array of corresponding blend positions for each animation clip. Used for 1D blending. Not used if the layer has only one animation clip.
|
SetBlendRange |
FlexMotionLayer |
Sets the start and end range used during blending. For 1D blending, this value is ignored if the Blend Positions has been set.
|
SetBlendWeight |
FlexMotionLayer |
Changes the blending weight value of an animation clip based on its index.
Obviously this has no effect on layers containing only one animation clip.
|
SetFrameTime |
FlexMotionLayer |
Sets the layer's current animation frame time. Every animation clip will be affected.
The computation is based on the animation clip with the highest weight.
As retrieving the AnimationClip from a playable is slow, avoid using this method in an update loop.
|
SetIsMirror |
FlexMotionLayer |
Sets if the pose should be mirrored or not.
|
SetNormalizedTime |
FlexMotionLayer |
Sets the layer's current animation normalized time (from 0f to 1f). Every animation clip will be affected.
|
SetPose |
FlexMotionLayer |
Sets the layer to a pose by pausing it and applying a normalized time on every animation clips.
The normalized time to apply on the animation clips.
|
SetSpeed |
FlexMotionLayer |
Sets the speed multiplier of the Layer.
|
SetTime |
FlexMotionLayer |
Sets the layer's current animation time (in seconds). Every animation clip will be affected.
|
SetTransition |
FlexMotionLayer |
Sets the transition to apply when the
FlexMotionLayer transitions from one state to another.
If that layer is currently in a in transition, the other layers in a out transition will also use that new transition settings.
Not doing so will lead to disjointed transitions as it the time and weights will not match.
|
SetTransitionEasing |
FlexMotionLayer |
Sets the easing function to use during the transition.
It will impacts current and future transitions for every layers on the same mask layer.
|
SetTransitionTime |
FlexMotionLayer |
Sets the duration of the transition.
It will impacts current and future transitions for every layers on the same mask layer.
|
Set |
FlexMotionLayer |
Should the layer recompute every clip speed value using their weights?
This will be done every frame to achieve a consistent length.
|
SkipTransition |
FlexMotionLayer |
Skips the current transition for every motion layers on the same mask layer.
Do nothing if no transition is currently occuring.
|
Stop |
void |
Stops the layer, starting its out transition. |
SwitchPause |
void |
Switches the pause state of the underlying
FlexMotionMaskLayer .
If it's currently playing, this method will pause it. If it is paused, calling the method will unpause it.
It's important to note that if paused, transitions will be paused as well.
|
SwitchPose |
void |
Switches the pose state.
It can be used as a pause that doesn't impact transitions.
|
Unpause |
void |
Unpause the the underlying
FlexMotionMaskLayer if it was paused.
|
Events
Name | Type | Summary |
---|---|---|
Completed | FlexMotionLayer |
Event that is signalled when the FlexMotionLayer motion time crosses its current length.
You don't need to manually unsubscribe from this event.
Please consider using
OnComplete<T>(T, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|
Stopped | FlexMotionLayer |
Event that is signalled when the FlexMotionLayer has been stopped thus starting its out transition.
You don't need to manually unsubscribe from this event.
Please consider using
OnStopped<T>(T, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
|