Summary
A flexible play-on-demand animation component using Playables.
Syntax
[RequireComponent(typeof(Animator)), AddComponentMenu("FlexMotion/FlexMotionAnimator")]
public class FlexMotionAnimator : MonoBehaviour
Fields
Name | Field Type | Summary |
---|---|---|
applyFootIkOnPlay | bool |
Turns on or off the foot Ik setting on a layer when playing an animation.
|
applyMirrorOnPlay | bool |
Should the entire animator be mirrored? Only works for Humanoid rig.
|
apply |
bool |
Turns on or off the playable Ik setting on a layer when playing an animation.
It enables the
OnAnimatorIk messages in MonoBehavior scripts.
|
applyRootMotion | bool |
Should the root motion be applied automatically?
|
defaultTransition | FlexMotionTransition |
The transition that will be used by default.
|
prevent |
bool |
Should inactive animation layers with a different animation asset not be reused?
|
useMecanimRootMotion | bool |
Should the velocity values from Mecanim be used when applying the root motion?
|
Properties
Name | Property Type | Summary |
---|---|---|
AngularVelocity | Vector3 |
Get the root motion angular velocity of the animated object.
It is the accumulation of every motion layer's angular velocity.
Should be typically accessed from an OnAnimatorMove callback.
|
IsHuman | bool |
Returns true if the mecanim animator is using an humanoid rig, false if it is generic.
|
MecanimAnimator | Animator |
The underlying Mecanim animation component.
|
MecanimWeight | float |
The blending weight between the FlexMotion animator and any currently running Mecanim animator.
The value ranges from 0 for only displaying the FlexMotion animations to 1 to do the same for the Mecanim animator.
A value outside that range is stored but still processed as 0 or 1.
|
MotionLayers | FlexMotionLayer[] |
The array of FlexMotionLayer layers managed by that FlexMotionAnimator.
|
Speed | float |
A time multiplier to be applied on the entire animator.
|
UpdateMode | FlexMotionUpdateMode |
Set the type of DeltaTime to use when updating the animator.
|
UpdateRate | float |
Set how frequently the animator should be updated. 0 or less updates the animator every frame.
|
Velocity | Vector3 |
Get the root motion velocity of the animated object.
It is the accumulation of every motion layer's velocity.
Should be typically accessed from an OnAnimatorMove callback.
|
Methods
Name | Return Value | Summary |
---|---|---|
DeleteAnimationJob |
void |
Delete the AnimationScriptPlayable from a previously inserted animation job.
|
Evaluate |
void |
Updates a set of FlexMotionLayers based on their state, weighting, and time scale, and evaluates the playable graph with the given deltaTime.
|
Initialize |
void |
Initialize the PlayableGraph. There is typically no need to call this manually.
|
InsertAnimationJob |
Animation |
Insert an Animation Job that will affect every mask and animation layer.
This will create an AnimationScriptPlayable and insert it into the PlayableGraph.
|
Play |
FlexMotionLayer |
Plays the specified AnimationClip and returns the FlexMotionLayer that will be playing the contained animation clips.
|
Play |
FlexMotionLayer |
Plays the specified FlexMotion asset and returns the FlexMotionLayer that will be playing the contained animation clips.
|
PlayOrResume |
FlexMotionLayer |
Plays the specified
AnimationClip asset if there is no layer currently running with the same clip.
This is very useful if you need to continuously ensure that an animation is playing from an update method.
Returns the FlexMotionLayer playing the animation clip.
|
PlayOrResume |
FlexMotionLayer |
Plays the specified
FlexMotion asset if there is no layer currently running with the same animation clips.
This is very useful if you need to continuously ensure that an animation is playing from an update method.
Returns the FlexMotionLayer playing that FlexMotion asset.
|
Preload |
void |
Preload an animation asset without playing it.
This method will always create a new motion layer if no existing layer is using the same asset.
|
Preload |
void |
Preload an animation asset without playing it.
This method will always create a new motion layer if no existing layer is using the same asset.
|
SetApplyFootIkOnPlay |
void |
Turns on or off the foot Ik setting on a layer when playing an animation.
|
SetApplyMirrorOnPlay |
void |
Should the entire animator be mirrored? Only works for Humanoid rig.
|
Set |
void |
Turns on or off the playable Ik setting on a layer when playing an animation.
It enables the
OnAnimatorIk messages in MonoBehavior scripts.
|
SetApplyRootMotion |
void |
Should the root motion be applied automatically?
|
SetDefaultTransition |
void |
Change the animator default transition with the provided transition.
|
SetMaskLayerWeight |
void | |
SetMecanimWeight |
void |
Sets the blending weight between the FlexMotion animator and any currently running Mecanim animator.
The value ranges from 0 for only displaying the FlexMotion animations to 1 to do the same for the Mecanim animator.
A value outside that range is stored but still processed as 0 or 1.
|
SetSpeed |
void |
A time multiplier to be applied on the entire animator.
|
SetUpdateMode |
void |
Set the type of DeltaTime to use when updating the animator.
|
SetUpdateRate |
void |
Set how frequently the animator should be updated. 0 or less updates the animator every frame.
|
Set |
void |
Should the velocity values from Mecanim be used when applying the root motion?
|
StopAll |
void |
Stops every motion layers if it is active using the default transition.
|
StopAll |
void |
Stops every motion layers on a given mask layer index if it is active.
|
StopAll |
void |
Stops every motion layers if it is active using the given transition.
|
StopAll |
void |
Stops every motion layers on a given mask layer index if it is active using the default transition.
|
SwitchPauseAll |
void |
Switches the pause state of every Mask layers.
If the layers are currently playing, this method will pause them. If they are paused, it will unpause them.
|
SwitchPauseAll |
void |
Switches the pause state of the specified Mask Layer.
If the mask layer is currently unpaused, this method will pause them. If they are paused, it will unpause them.
|
TryGetLayer |
bool |
This method tries to retrieve a
FlexMotionLayer playing the specified FlexMotion asset.
In the case if two layers with the same asset is playing (I.E. Self-transition), the layer in In or Active state will be prioritized.
If the layer is found, it will be assigned to the output parameter "motionLayer" and the method will return true.
If the layer is not found, "motionLayer" will be set to null and the method will return false.
The mask layer index parameter is optional and defaults to 0 if not specified.
|
Events
Name | Type | Summary |
---|---|---|
AnimatorIk | FlexMotionAnimator |
Event that is signalled when the OnAnimatorIK callback is called.
The event allows a script to handle that case from a GameObject that doesn't have the animator attached to it.
|
Played | FlexMotionAnimator |
Event that is signalled when a
FlexMotion asset or Animation Clip is played.
The arguments are the FlexMotionAnimator and the played FlexMotionLayer .
|