SAnimator
Index
Functions Index
Function Name |
---|
void Rebind () |
void Stop () |
void SetTime (double time) |
double GetTime () |
double GetNormalizedTime (int layer=0) |
double GetLength (int layer=0) |
bool GetLoop (int layer=0) |
int GetInteger (string name) int GetInteger (int id) |
void ResetTrigger (string name) void ResetTrigger (int id) |
bool IsParameterControlledByCurve (string name) bool IsParameterControlledByCurve (int id) |
string GetLayerName (int layerIndex) |
int GetLayerIndex (string layerName) |
float GetLayerWeight (int layerIndex) |
void SetLayerWeight (int layerIndex, float weight) |
bool IsInTransition (int layerIndex) |
void CrossFadeInFixedTime (string stateName, float transitionDuration, int layer) void CrossFadeInFixedTime (string stateName, float transitionDuration) void CrossFadeInFixedTime (string stateName, float transitionDuration, int layer, float fixedTime) |
void PlayInFixedTime (string stateName, int layer) void PlayInFixedTime (string stateName) void PlayInFixedTime (string stateName, int layer, float fixedTime) |
void StartPlayback () |
void StopPlayback () |
void StartRecording () |
void StopRecording () |
void Update (float deltaTime) |
void SetTrigger (string trigger) void SetTrigger (int id) |
void SetInteger (string name, int value) void SetInteger (int id, int value) |
int StringToHash (string name) |
SAnimatorStateInfo GetCurrentAnimatorStateInfo (int Layerindex) |
Properties Index
Property Name |
---|
SResource Controller |
SResource Avatar |
bool ApplyRootMotion |
float PlaybackTime |
bool Enabled |
string[] Parameters |
Functions
Rebind
void Rebind ()
Rebind all the animated properties and mesh data with the Animator.
Stop
void Stop ()
Stop the Animator.
SetTime
void SetTime (double time)
Function Description
Parameter | Type | Description |
---|---|---|
GetTime
double GetTime ()
Function Description
GetNormalizedTime
double GetNormalizedTime (int layer=0)
Normalized time of the State. The integer part is the number of time a state has been looped. The fractional part is the % (0-1) of progress in the current loop.
Parameter | Type | Description |
---|---|---|
GetLength
double GetLength (int layer=0)
Current duration of the state.
Parameter | Type | Description |
---|---|---|
GetLoop
bool GetLoop (int layer=0)
Is the state looping.
Parameter | Type | Description |
---|---|---|
GetFloat
float GetFloat (string name) float GetFloat (int id)
Returns the value of the given float parameter. name: The name of the parameter. id: The id of the parameter.
Parameter | Type | Description |
---|---|---|
GetBool
bool GetBool (string name) bool GetBool (int id)
Returns the value of the given boolean parameter. name: The name of the parameter. id: The id of the parameter.
Parameter | Type | Description |
---|---|---|
GetInteger
int GetInteger (string name) int GetInteger (int id)
Returns the value of the given integer parameter. name: The name of the parameter. id: The id of the parameter.
Parameter | Type | Description |
---|---|---|
ResetTrigger
void ResetTrigger (string name) void ResetTrigger (int id)
Resets the trigger parameter to false.
Parameter | Type | Description |
---|---|---|
IsParameterControlledByCurve
bool IsParameterControlledByCurve (string name)
bool IsParameterControlledByCurve (int id)
Returns true if a parameter is controlled by an additional curve on an animation.
Parameter | Type | Description |
---|---|---|
GetLayerName
string GetLayerName (int layerIndex)
Gets name of the layer.
Parameter | Type | Description |
---|---|---|
GetLayerIndex
int GetLayerIndex (string layerName)
Gets the index of the layer with specified name.
Parameter | Type | Description |
---|---|---|
GetLayerWeight
float GetLayerWeight (int layerIndex)
Gets the layer's current weight.
Parameter | Type | Description |
---|---|---|
SetLayerWeight
void SetLayerWeight (int layerIndex, float weight)
Sets the weight of the layer at the given index.
Parameter | Type | Description |
---|---|---|
IsInTransition
bool IsInTransition (int layerIndex)
Is the specified layer in a transition.
Parameter | Type | Description |
---|---|---|
CrossFadeInFixedTime
void CrossFadeInFixedTime (string stateName, float transitionDuration)
void CrossFadeInFixedTime (string stateName, float transitionDuration, int layer)
void CrossFadeInFixedTime (string stateName, float transitionDuration, int layer, float fixedTime)
Creates a dynamic transition between the current state and the destination state. The duration and offset in the target state are in fixed time. stateName: The name of the destination state. transitionDuration: The duration of the transition. Value is in seconds. layer: Layer index containing the destination state. If no layer is specified or layer is -1, the first state that is found with the given name or hash will be played. fixedTime: Start time of the current destination state. Value is in seconds. If no explicit fixedTime is specified or fixedTime value is float.NegativeInfinity, the state will either be played from the start if it's not already playing, or will continue playing from its current time and no transition will happen.
Parameter | Type | Description |
---|---|---|
CrossFade
void CrossFade (string stateName, float transitionDuration)
void CrossFade (string stateName, float transitionDuration, int layer)
void CrossFade (string stateName, float transitionDuration, int layer, float normalizedTime)
Creates a dynamic transition between the current state and the destination state. stateName: The name of the destination state. transitionDuration: The duration of the transition. Value is in source state normalized time. layer: Layer index containing the destination state. If no layer is specified or layer is -1, the first state that is found with the given name or hash will be played. normalizedTime: Start time of the current destination state. Value is in source state normalized time, should be between 0 and 1. If no explicit normalizedTime is specified or normalizedTime value is float.NegativeInfinity, the state will either be played from the start if it's not already playing, or will continue playing from its current time and no transition will happen.
Parameter | Type | Description |
---|---|---|
PlayInFixedTime
void PlayInFixedTime (string stateName, int layer) void PlayInFixedTime (string stateName) void PlayInFixedTime (string stateName, int layer, float fixedTime)
Plays a state. The offset in the target state is in fixed time. stateName: The name of the state to play. Layer index containing the destination state. If no layer is specified or layer is -1, the first state that is found with the given name or hash will be played.
Parameter | Type | Description |
---|---|---|
Play
void Play (string stateName)
void Play (string stateName, int layer)
void Play (string stateName, int layer, float normalizedTime)
Plays a state.
Parameter | Type | Description |
---|---|---|
stateName | string | The name of the state to play. |
layer | int | Layer index containing the destination state. If no layer is specified or layer is -1, the first state that is found with the given name or hash will be played. |
normalizedTime | float | Start time of the current destination state. Value is in normalized time. If no explicit normalizedTime is specified or value is float.NegativeInfinity, the state will either be played from the start if it's not already playing, or will continue playing from its current time. |
StartPlayback
void StartPlayback ()
Sets the animator in playback mode.
StopPlayback
void StopPlayback ()
Stops the animator playback mode. When playback stops, the avatar resumes getting control from game logic.
StartRecording
void StartRecording ()
Sets the animator in recording mode. The recording will continue until the user calls StopRecording. Maximum 10,000 frames. Note it is not possible to start playback until a call to StopRecording is made
StopRecording
void StopRecording ()
Stops animator record mode.
Update
void Update (float deltaTime)
Function Description
Parameter | Type | Description |
---|---|---|
SetTrigger
void SetTrigger (string trigger)
void SetTrigger (int id)
Sets a trigger parameter to active. A trigger parameter is a bool parameter that gets reset to false when it has been used in a transition. For state machines with multiple layers, the trigger will only get reset once all layers have been evaluated, so that the layers can synchronize their transitions on the same parameter.
Parameter | Type | Description |
---|---|---|
SetFloat
void SetFloat (string name, float value)
void SetFloat (string name, float value, float dampTime, float deltaTime)
void SetFloat (int id, float value)
void SetFloat (int id, float value, float dampTime, float deltaTime)
Send float values to the Animator to affect transitions. dampTime: The damper total time. deltaTime: The delta time to give to the damper.
Parameter | Type | Description |
---|---|---|
SetBool
void SetBool (int id, bool value) void SetBool (string name, bool value)
Sets the value of a boolean parameter.
Parameter | Type | Description |
---|---|---|
SetInteger
void SetInteger (string name, int value) void SetInteger (int id, int value)
Sets the value of the given integer parameter.
Parameter | Type | Description |
---|---|---|
StringToHash
int StringToHash (string name)
Generates an parameter id from a string. Ids are used for optimized setters and getters on parameters.
Parameter | Type | Description |
---|---|---|
GetCurrentAnimatorStateInfo
SAnimatorStateInfo GetCurrentAnimatorStateInfo (int Layerindex)
Returns an SAnimatorStateInfo with the information on the current state..
Parameter | Type | Description |
---|---|---|
Properties
Controller
SResource Controller get
set
The Animator Controller resource of this Animator
Avatar
SResource Avatar get
set
Gets/Sets the current Avatar.
ApplyRootMotion
bool ApplyRootMotion get
set
Should root motion be applied?
Root motion is the effect where an object's entire mesh moves away from its starting point but that motion is created by the animation itself rather than by changing the Transform position.
PlaybackTime
float PlaybackTime get
set
Property Description
Enabled
bool Enabled get
set
Whether the Animator component is enabled or not
Parameters
string[] Parameters get
The AnimatorControllerParameter list used by the animator.
GameObject
SGameObject GameObject get
Returns a reference to the GameObject of this component.
Last updated