Intro to mecanim

Published by

on

Intro to Mecanim

How to control animation

Animation

Keyframes over time

img2

Controlling animation

The animator component serves as a communication relay to the system.

img1
public class AdamFolse_AnimationBehaviour : MonoBehaviour
{
public Animator adamAnimator;
}

Parameters

set of values we can send to it

logo
public class AdamFolse_AnimationBehaviour : MonoBehaviour
{
public Animator adamAnimator;
public float adamSpeed;
public int adamHealth;

public void Update()
{
//send values to the animator here ie: adamSpeed and adamHealth
}
}

States

Uses the animations

img3

Transitions

Uses the parameters through conditions

img4
img5
gif1
public class AdamFolse_AnimationBehaviour : MonoBehaviour
{
public Animator adamAnimator;
public float adamSpeed;
public int adamHealth;

public void Update()
{
//send Health parameter the value 1
adamAnimator.SetInteger("Health", 1);//we could send Health parameter the variable adamHealth or we could also send a constant value
//send Speed parameter the variable adamSpeed
adamAnimator.SetFloat("Speed", adamSpeed);
}
}

Leave a comment

Previous Post
Next Post