User Tools

Site Tools


mecanimcontrol

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mecanimcontrol [2015/03/14 23:51]
Mistermind
mecanimcontrol [2018/09/17 10:29] (current)
Mistermind [Public Variables]
Line 6: Line 6:
 **Mecanim Control** is a coding tool made that allow for a wider variety of common methods used by the [[http://docs.unity3d.com/Documentation/ScriptReference/Animation.html|Animation component]] with Mecanim (Humanoid/Generic) animations. It allows you to not only dynamically load any animation clip during runtime, but also tap into several methods currently missing in this magnificent system. **Mecanim Control** is a coding tool made that allow for a wider variety of common methods used by the [[http://docs.unity3d.com/Documentation/ScriptReference/Animation.html|Animation component]] with Mecanim (Humanoid/Generic) animations. It allows you to not only dynamically load any animation clip during runtime, but also tap into several methods currently missing in this magnificent system.
  
-[[http://forum.unity3d.com/threads/224315-Mecanim-Control|Mecanim Control]] is a sub-tool of [[http://forum.unity3d.com/threads/218123-RELEASED-Universal-Fighting-Engine-(UFE)|Universal Fighting Engine]]. It's source code is available entirely free in the **Source** version of UFE. 
  
 ---- ----
  
 ==== Overview ==== ==== Overview ====
 +
 +{{ :mecanimcontrol2ss.jpg |}}
 +
 You can use MecanimControl much like you would use the animation component.\\ You can use MecanimControl much like you would use the animation component.\\
 To play a simple animation use //MecanimControl.Play//\\ To play a simple animation use //MecanimControl.Play//\\
Line 51: Line 53:
   * [[#debugmode|Debug Mode]]   * [[#debugmode|Debug Mode]]
   * [[#alwaysplay|Always Play]]   * [[#alwaysplay|Always Play]]
 +  * [[#overriderootmotion|Override Root Motion]]
   * [[#defaulttransitionduration|Default Transition Duration]]   * [[#defaulttransitionduration|Default Transition Duration]]
   * [[#defaultwrapmode|Default Wrap Mode]]   * [[#defaultwrapmode|Default Wrap Mode]]
Line 59: Line 62:
 **Default Animation**\\ **Default Animation**\\
 AnimationData //defaultAnimation//;\\ AnimationData //defaultAnimation//;\\
-By default, if no order is given, the animator will play the animation stored in this AnimationData.+By default, if no order is given, the animator will play the animation stored in this AnimationData. If you don't assign an animation, Mecanim Control will instantiate the first animation listed on [[#animations|animations]].
  
 <code c#> <code c#>
Line 72: Line 75:
 **Animations**\\ **Animations**\\
 AnimationData[] //animations//;\\ AnimationData[] //animations//;\\
-The array containing all the AnimationData stored by either the UI or by using AddClip.+ 
 +**Properties**\\ 
 +AnimationClip clip - The AnimationClip file.\\ 
 +string clipName - Animation name.\\ 
 +float speed - Animation speed.\\ 
 +float transitionDuration - Blending Duration.\\ 
 +WrapMode wrapMode - The animation's default [[http://docs.unity3d.com/ScriptReference/WrapMode.html|WrapMode]].\\ 
 +bool applyRootMotion - If this and //Override Root Motion// is toggled this animation will toggle the Animator's [[http://docs.unity3d.com/Manual/RootMotion.html|Root Motion]] 
 + 
 +**Description**\\ 
 +This array contain all the AnimationData stored by either the UI or by using AddClip. Its then used to emulate a state machine under the //Animator Controller//.
  
 <code c#> <code c#>
Line 107: Line 120:
  mecanimControl = gameObject.GetComponent<MecanimControl>();  mecanimControl = gameObject.GetComponent<MecanimControl>();
  mecanimControl.alwaysPlay = true;  mecanimControl.alwaysPlay = true;
 +}
 +</code>
 +
 +----
 +{{anchor:overriderootmotion}}
 +**Override Root Motion**\\
 +bool //overrideRootMotion//;\\
 +If both applyRootMotion (under the animation element) and this variable is //true//, this animation will toggle the Animator's [[http://docs.unity3d.com/Manual/RootMotion.html|Root Motion]].
 +
 +
 +<code c#>
 +void Start () {
 + mecanimControl = gameObject.GetComponent<MecanimControl>();
 + mecanimControl.overrideRootMotion = true;
 + mecanimControl.animationData[0].applyRootMotion = true;
 } }
 </code> </code>
Line 170: Line 198:
 void //AddClip(AnimationClip clip, string name, float speed, WrapMode wrapMode)//; void //AddClip(AnimationClip clip, string name, float speed, WrapMode wrapMode)//;
  
-**Description:** 
-Adds a clip to //animations// with the name //newName//. 
- 
----- 
 **Parameters**\\ **Parameters**\\
 clip - The AnimationClip file.\\ clip - The AnimationClip file.\\
Line 179: Line 203:
 speed - Animation speed.\\ speed - Animation speed.\\
 wrapMode - The animation's default [[http://docs.unity3d.com/ScriptReference/WrapMode.html|WrapMode]]. wrapMode - The animation's default [[http://docs.unity3d.com/ScriptReference/WrapMode.html|WrapMode]].
-----+ 
 +**Description:** 
 +Adds a clip to //animations// with the name //newName//.
  
 <code c#> <code c#>
Line 201: Line 227:
 void //CrossFade(AnimationData animationData, float blendingTime, float normalizedTime, bool mirror);//\\ void //CrossFade(AnimationData animationData, float blendingTime, float normalizedTime, bool mirror);//\\
  
----- 
 **Parameters**\\ **Parameters**\\
 clipName - Animation name.\\ clipName - Animation name.\\
Line 207: Line 232:
 blendingTime - The blending duration between the 2 animations.\\ blendingTime - The blending duration between the 2 animations.\\
 normalizedTime - The timeline's position of the animation to be played (0-1)\\ normalizedTime - The timeline's position of the animation to be played (0-1)\\
-mirror - Should the animation be mirrored?\\ +mirror - Should the animation be mirrored?
-----+
  
 **Description:** **Description:**
Line 233: Line 257:
 AnimationData //GetAnimationData(string clipName);//\\ AnimationData //GetAnimationData(string clipName);//\\
  
----- 
 **Parameters**\\ **Parameters**\\
 clip - Animation clip.\\ clip - Animation clip.\\
-clipName - Clip name.\\ +clipName - Clip name.
-----+
  
 **Description:** **Description:**
Line 350: Line 372:
 float //GetSpeed(string clipName);//\\ float //GetSpeed(string clipName);//\\
  
----- 
 **Parameters**\\ **Parameters**\\
 clip - Animation clip.\\ clip - Animation clip.\\
 clipName - Clip name.\\ clipName - Clip name.\\
----- 
  
 **Description:** **Description:**
Line 412: Line 432:
 void //Play(string clipName, float blendingTime, float normalizedTime, bool mirror);//\\ void //Play(string clipName, float blendingTime, float normalizedTime, bool mirror);//\\
 void //Play(AnimationClip clip, float blendingTime, float normalizedTime, bool mirror);//\\ void //Play(AnimationClip clip, float blendingTime, float normalizedTime, bool mirror);//\\
 +
 +**Parameters**\\
 +clip - Animation clip.\\
 +clipName - Animation name.\\
 +animationData - The correspondent animation data.\\
 +blendingTime - The blending duration between the 2 animations.\\
 +normalizedTime - The timeline's position of the animation to be played (0-1)\\
 +mirror - Should the animation be mirrored?
  
 **Description:** **Description:**
mecanimcontrol.1426391493.txt.gz · Last modified: 2015/03/14 23:51 by Mistermind