This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
mecanimcontrol [2014/02/23 17:29] 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:// | **Mecanim Control** is a coding tool made that allow for a wider variety of common methods used by the [[http:// | ||
- | [[http:// | ||
---- | ---- | ||
==== Overview ==== | ==== Overview ==== | ||
+ | |||
+ | {{ : | ||
+ | |||
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 // | To play a simple animation use // | ||
To cross-fade between animations use // | To cross-fade between animations use // | ||
- | To change how animations wrap (Loop, Once, PingPong) change the WrapMode of the respective | + | To change how animations wrap (Loop, Once, PingPong) change the WrapMode of the respective |
// | // | ||
Line 51: | Line 53: | ||
* [[# | * [[# | ||
* [[# | * [[# | ||
+ | * [[# | ||
* [[# | * [[# | ||
* [[# | * [[# | ||
Line 59: | Line 62: | ||
**Default Animation**\\ | **Default Animation**\\ | ||
AnimationData // | AnimationData // | ||
- | 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 [[# |
<code c#> | <code c#> | ||
Line 72: | Line 75: | ||
**Animations**\\ | **Animations**\\ | ||
AnimationData[] // | AnimationData[] // | ||
- | The array containing | + | |
+ | **Properties**\\ | ||
+ | AnimationClip clip - The AnimationClip file.\\ | ||
+ | string clipName - Animation name.\\ | ||
+ | float speed - Animation speed.\\ | ||
+ | float transitionDuration - Blending Duration.\\ | ||
+ | WrapMode wrapMode - The animation' | ||
+ | bool applyRootMotion - If this and //Override Root Motion// is toggled this animation will toggle the Animator' | ||
+ | |||
+ | **Description**\\ | ||
+ | This array contain | ||
<code c#> | <code c#> | ||
Line 107: | Line 120: | ||
mecanimControl = gameObject.GetComponent< | mecanimControl = gameObject.GetComponent< | ||
mecanimControl.alwaysPlay = true; | mecanimControl.alwaysPlay = true; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | {{anchor: | ||
+ | **Override Root Motion**\\ | ||
+ | bool // | ||
+ | If both applyRootMotion (under the animation element) and this variable is //true//, this animation will toggle the Animator' | ||
+ | |||
+ | |||
+ | <code c#> | ||
+ | void Start () { | ||
+ | mecanimControl = gameObject.GetComponent< | ||
+ | mecanimControl.overrideRootMotion = true; | ||
+ | mecanimControl.animationData[0].applyRootMotion = true; | ||
} | } | ||
</ | </ | ||
Line 169: | Line 197: | ||
void // | void // | ||
void // | void // | ||
+ | |||
+ | **Parameters**\\ | ||
+ | clip - The AnimationClip file.\\ | ||
+ | name - Animation name.\\ | ||
+ | speed - Animation speed.\\ | ||
+ | wrapMode - The animation' | ||
**Description: | **Description: | ||
Line 191: | Line 225: | ||
void // | void // | ||
void // | void // | ||
+ | void // | ||
+ | |||
+ | **Parameters**\\ | ||
+ | clipName - Animation name.\\ | ||
+ | animationData - The correspondent animation data.\\ | ||
+ | blendingTime - The blending duration between the 2 animations.\\ | ||
+ | normalizedTime - The timeline' | ||
+ | mirror - Should the animation be mirrored? | ||
**Description: | **Description: | ||
Line 214: | Line 256: | ||
AnimationData // | AnimationData // | ||
AnimationData // | AnimationData // | ||
+ | |||
+ | **Parameters**\\ | ||
+ | clip - Animation clip.\\ | ||
+ | clipName - Clip name. | ||
**Description: | **Description: | ||
Line 325: | Line 371: | ||
float // | float // | ||
float // | float // | ||
+ | |||
+ | **Parameters**\\ | ||
+ | clip - Animation clip.\\ | ||
+ | clipName - Clip name.\\ | ||
**Description: | **Description: | ||
Line 382: | Line 432: | ||
void // | void // | ||
void // | void // | ||
+ | |||
+ | **Parameters**\\ | ||
+ | clip - Animation clip.\\ | ||
+ | clipName - Animation name.\\ | ||
+ | animationData - The correspondent animation data.\\ | ||
+ | blendingTime - The blending duration between the 2 animations.\\ | ||
+ | normalizedTime - The timeline' | ||
+ | mirror - Should the animation be mirrored? | ||
**Description: | **Description: | ||
Line 508: | Line 566: | ||
void // | void // | ||
void // | void // | ||
+ | void // | ||
**Description: | **Description: |