wiki.sine.space | sinespace

Difference between revisions of "Scripting/SAnimator"

From wiki.sine.space
Jump to: navigation, search
(Created page with "The SAnimator class component interfaces with Unity's Animator component, exposing its functions to scripting. ==Members== {{ScriptFunction|void|SetTrigger|(string name);|Set...")
 
(Added and defined all members (51) of SAnimator)
Line 1: Line 1:
The SAnimator class component interfaces with Unity's Animator component, exposing its functions to scripting.
 
  
==Members==
+
==Members== 47
{{ScriptFunction|void|SetTrigger|(string name);|Sets a trigger value for a animator}}
+
{{ScriptFunction|void|CrossFade|(string stateName, float transitionDuration);|Creates a dynamic transition between the current state and the destination state.
{{ScriptFunction|void|SetFloat|(string name, float value);|Sets a float parameter for a animator}}
+
stateName: The name of the destination state.
{{ScriptFunction|void|SetInteger|(string name, int value);|Sets a integer parameter for a animator}}
+
transitionDuration: The duration of the transition. Value is in source state normalized time.|5=<pre></pre>}}
{{ScriptFunction|void|SetBool|(string name, bool value);|Sets a boolean parameter for a animator}}
+
{{ScriptFunction|void|CrossFade|(string stateName, float transitionDuration, int layer);|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.|5=<pre></pre>}}
 +
{{ScriptFunction|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.
 +
|5=<pre></pre>}}
 +
{{ScriptFunction|void|CrossFadeInFixedTime|(string stateName, float transitionDuration);|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.|5=<pre></pre>}}
 +
{{ScriptFunction|void|CrossFadeInFixedTime|(string stateName, float transitionDuration, int layer);|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.|5=<pre></pre>}}
 +
{{ScriptFunction|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.
 +
|5=<pre></pre>}}
 +
{{ScriptFunction|bool|GetBool|(string name);|Returns the value of the given boolean parameter.
 +
name: The name of the parameter.|5=<pre></pre>}}
 +
{{ScriptFunction|bool|GetBool|(int id);|Returns the value of the given boolean parameter.
 +
id: The id of the parameter.|5=<pre</pre>}}
 +
{{ScriptFunction|float|GetFloat|(string name);|Returns the value of the given float parameter.
 +
name: The name of the parameter.|5=<pre></pre>}}
 +
{{ScriptFunction|float|GetFloat|(int id);|Returns the value of the given float parameter.
 +
id: The id of the parameter.|5=<pre</pre>}}
 +
{{ScriptFunction|int|GetInteger|(string name);|Returns the value of the given integer parameter.
 +
name: The name of the parameter.|5=<pre></pre>}}
 +
{{ScriptFunction|int|GetInteger|(int id);|Returns the value of the given integer parameter.
 +
id: The id of the parameter.|5=<pre</pre>}}
 +
{{ScriptFunction|int|GetLayerIndex|(string layerName);|Gets the index of the layer with specified name.|5=<pre></pre>}}
 +
{{ScriptFunction|string|GetLayerName|(int layerIndex);|Gets name of the layer.|5=<pre></pre>}}
 +
{{ScriptFunction|float|GetLayerWeight|(int layerIndex);|Gets the layer's current weight.|5=<pre></pre>}}
 +
{{ScriptFunction|double|GetLength|(int layer = 0);|Player will 'Delete' this item.|5=<pre></pre>}}
 +
{{ScriptFunction|bool|GetLoop|(int layer = 0);|Player will 'Delete' this item.|5=<pre></pre>}}
 +
{{ScriptFunction|double|GetNormalizedTime|(int layer = 0);|Player will 'Delete' this item.|5=<pre></pre>}}
 +
{{ScriptFunction|double|GetTime|();|Player will 'Delete' this item.|5=<pre></pre>}}
 +
{{ScriptFunction|bool|IsInTransition|(int layer = 0);|Is the specified layer in a transition.|5=<pre></pre>}}
 +
{{ScriptFunction|bool|IsParameterControlledByCurve|(int id);|Returns true if a parameter is controlled by an additional curve on an animation.|5=<pre></pre>}}
 +
{{ScriptFunction|bool|IsParameterControlledByCurve|(string name);|Returns true if a parameter is controlled by an additional curve on an animation.|5=<pre></pre>}}
 +
{{ScriptFunction|void|Play|(string stateName);|Plays a state.
 +
stateName: The name of the state to play.|5=<pre></pre>}}
 +
{{ScriptFunction|void|Play|(string stateName, int layer);|Plays a state.
 +
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.|5=<pre></pre>}}
 +
{{ScriptFunction|void|Play|(string stateName, int layer, float normalizedTime);|Plays a state.
 +
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.
 +
normalizedTime: 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.|5=<pre></pre>}}
 +
{{ScriptFunction|void|PlayInFixedTime|(string stateName);|Plays a state. The offset in the target state is in fixed time.
 +
stateName: The name of the state to play.|5=<pre></pre>}}
 +
{{ScriptFunction|void|PlayInFixedTime|(string stateName, int layer);|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.|5=<pre></pre>}}
 +
{{ScriptFunction|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.
 +
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.|5=<pre></pre>}}
 +
{{ScriptFunction|void|Rebind|();|Rebind all the animated properties and mesh data with the Animator.|5=<pre></pre>}}
 +
{{ScriptFunction|void|ResetTrigger|(int id);|Resets the trigger parameter to false.|5=<pre></pre>}}
 +
{{ScriptFunction|void|ResetTrigger|(string name);|Resets the trigger parameter to false.|5=<pre></pre>}}
 +
{{ScriptFunction|void|SetBool|(int id, bool value);|Sets the value of a boolean parameter.|5=<pre></pre>}}
 +
{{ScriptFunction|void|SetBool|(string name, bool value);|Sets the value of a boolean parameter.|5=<pre></pre>}}
 +
{{ScriptFunction|void|SetFloat|(int id, float value);|Send float values to the Animator to affect transitions.|5=<pre></pre>}}
 +
{{ScriptFunction|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.|5=<pre></pre>}}
 +
{{ScriptFunction|void|SetFloat|(string name, float value);|Send float values to the Animator to affect transitions.|5=<pre></pre>}}
 +
{{ScriptFunction|void|SetFloat|(string name, 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.|5=<pre></pre>}}
 +
{{ScriptFunction|void|SetInteger|(int id, int value);|Sets the value of the given integer parameter.|5=<pre></pre>}}
 +
{{ScriptFunction|void|SetInteger|(string name, int value);|Sets the value of the given integer parameter.|5=<pre></pre>}}
 +
{{ScriptFunction|void|SetLayerWeight|(int layerIndex, float weight);|Sets the weight of the layer at the given index.|5=<pre></pre>}}
 +
{{ScriptFunction|void|SetTime|(double time);|Player will 'Delete' this item.|5=<pre></pre>}}
 +
{{ScriptFunction|void|SetTrigger|(int id);|Sets the value of the given trigger parameter.|5=<pre></pre>}}
 +
{{ScriptFunction|void|SetTrigger|(string trigger);|Sets the value of the given trigger parameter.|5=<pre></pre>}}
 +
{{ScriptFunction|void|StartPlayback|();|Sets the animator in playback mode.|5=<pre></pre>}}
 +
{{ScriptFunction|void|Stop|();|Stop the Animator.|5=<pre></pre>}}
 +
{{ScriptFunction|void|StopPlayback|();|Stops the animator playback mode. When playback stops, the avatar resumes getting control from game logic.|5=<pre></pre>}}
 +
{{ScriptFunction|void|Update|(float deltaTime);|Evaluates the animator based on deltaTime.|5=<pre></pre>}}
 +
 
 +
 
 +
 
 +
 
 +
==Properties==
 +
{{ScriptFunction|bool|ApplyRootMotion|{ get; }|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.|5=<pre></pre>}}
 +
{{ScriptFunction|SResource|Controller|{ get;set; }|The Animator Controller resource of this Animator|5=<pre></pre>}}
 +
{{ScriptFunction|bool|Enabled|{ get;set; }|Whether this is visually visible or not.|5=<pre></pre>}}
 +
{{ScriptFunction|string[]|Parameters|{ get;set; }|The AnimatorControllerParameter list used by the animator.|5=<pre></pre>}}
  
 
{{Scripting Navbox}}
 
{{Scripting Navbox}}

Revision as of 21:01, 17 December 2020

==Members== 47

CrossFade

void CrossFade (string stateName, float transitionDuration);

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.


CrossFade

void CrossFade (string stateName, float transitionDuration, int layer);

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.


CrossFade

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.



CrossFadeInFixedTime

void CrossFadeInFixedTime (string stateName, float transitionDuration);

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.


CrossFadeInFixedTime

void CrossFadeInFixedTime (string stateName, float transitionDuration, int layer);

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.


CrossFadeInFixedTime

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.



GetBool

bool GetBool (string name);

Returns the value of the given boolean parameter. name: The name of the parameter.


GetBool

bool GetBool (int id);

Returns the value of the given boolean parameter. id: The id of the parameter.

<pre</pre>


GetFloat

float GetFloat (string name);

Returns the value of the given float parameter. name: The name of the parameter.


GetFloat

float GetFloat (int id);

Returns the value of the given float parameter. id: The id of the parameter.

<pre</pre>


GetInteger

int GetInteger (string name);

Returns the value of the given integer parameter. name: The name of the parameter.


GetInteger

int GetInteger (int id);

Returns the value of the given integer parameter. id: The id of the parameter.

<pre</pre>


GetLayerIndex

int GetLayerIndex (string layerName);

Gets the index of the layer with specified name.


GetLayerName

string GetLayerName (int layerIndex);

Gets name of the layer.


GetLayerWeight

float GetLayerWeight (int layerIndex);

Gets the layer's current weight.


GetLength

double GetLength Player will 'Delete' this item.

No documentation


GetLoop

bool GetLoop Player will 'Delete' this item.

No documentation


GetNormalizedTime

double GetNormalizedTime Player will 'Delete' this item.

No documentation


GetTime

double GetTime ();

Player will 'Delete' this item.


IsInTransition

bool IsInTransition Is the specified layer in a transition.

No documentation


IsParameterControlledByCurve

bool IsParameterControlledByCurve (int id);

Returns true if a parameter is controlled by an additional curve on an animation.


IsParameterControlledByCurve

bool IsParameterControlledByCurve (string name);

Returns true if a parameter is controlled by an additional curve on an animation.


Play

void Play (string stateName);

Plays a state. stateName: The name of the state to play.


Play

void Play (string stateName, int layer);

Plays a state. 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.


Play

void Play (string stateName, int layer, float normalizedTime);

Plays a state. 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. normalizedTime: 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.


PlayInFixedTime

void PlayInFixedTime (string stateName);

Plays a state. The offset in the target state is in fixed time. stateName: The name of the state to play.


PlayInFixedTime

void PlayInFixedTime (string stateName, int layer);

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.


PlayInFixedTime

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. 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.


Rebind

void Rebind ();

Rebind all the animated properties and mesh data with the Animator.


ResetTrigger

void ResetTrigger (int id);

Resets the trigger parameter to false.


ResetTrigger

void ResetTrigger (string name);

Resets the trigger parameter to false.


SetBool

void SetBool (int id, bool value);

Sets the value of a boolean parameter.


SetBool

void SetBool (string name, bool value);

Sets the value of a boolean parameter.


SetFloat

void SetFloat (int id, float value);

Send float values to the Animator to affect transitions.


SetFloat

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.


SetFloat

void SetFloat (string name, float value);

Send float values to the Animator to affect transitions.


SetFloat

void SetFloat (string name, 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.


SetInteger

void SetInteger (int id, int value);

Sets the value of the given integer parameter.


SetInteger

void SetInteger (string name, int value);

Sets the value of the given integer parameter.


SetLayerWeight

void SetLayerWeight (int layerIndex, float weight);

Sets the weight of the layer at the given index.


SetTime

void SetTime (double time);

Player will 'Delete' this item.


SetTrigger

void SetTrigger (int id);

Sets the value of the given trigger parameter.


SetTrigger

void SetTrigger (string trigger);

Sets the value of the given trigger parameter.


StartPlayback

void StartPlayback ();

Sets the animator in playback mode.


Stop

void Stop ();

Stop the Animator.


StopPlayback

void StopPlayback ();

Stops the animator playback mode. When playback stops, the avatar resumes getting control from game logic.


Update

void Update (float deltaTime);

Evaluates the animator based on deltaTime.




Properties

ApplyRootMotion

bool ApplyRootMotion { get; }

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.


Controller

SResource Controller { get;set; }

The Animator Controller resource of this Animator


Enabled

bool Enabled { get;set; }

Whether this is visually visible or not.


Parameters

[[Scripting/string[]|string[]]] Parameters { get;set; }

The AnimatorControllerParameter list used by the animator.