Recorded Video Sessions on Animation
Tutorial
Beginner
2 Hours15 Mins
Overview
Overview
You have completed 0% of this Tutorial.
1.
Animate Anything with Mecanim
2.
Character Animation Setup
Summary
These recorded live sessions with Unity trainers demonstrate the basics of Unity's animation system, and the steps needed to import and setup a rigged character.
Topics we'll cover
Language
English
Recommended Unity Versions
4.5
Tutorial
Recorded Video Sessions on Animation
1.
Animate Anything with Mecanim
In this session we will have an introductory look at animating objects with the Mecanim animation tool and state machine. Many people feel that Mecanim is meant exclusively for animating humanoid bi-ped characters, but it can be used for so much more - and not only character animation, but animating UI Elements, opening doors, changing lights... any publicly exposed value can be animated with Mecanim. Let's do it! Tutor: Adam Buckner

DoorActivator

using UnityEngine; using System.Collections; public class DoorActivator : MonoBehaviour { public Animator[] lights; private Animator animator; void Awake () { animator = GetComponent <Animator>(); } void OnTriggerEnter (Collider other) { if (other.gameObject.tag == "Player") { animator.SetBool ("Open", true); foreach (var light in lights) { light.SetTrigger ("Activate"); } } } void OnTriggerExit (Collider other) { if (other.gameObject.tag == "Player") { animator.SetBool ("Open", false); } } }

2.
Character Animation Setup
In this session, we will look at the basic steps needed to import and setup a rigged character in Unity's animation system.
using UnityEngine; public class LocomotionSMB : StateMachineBehaviour { public float m_Damping = 0.15f; private readonly int m_HashHorizontalPara = Animator.StringToHash ("Horizontal"); private readonly int m_HashVerticalPara = Animator.StringToHash ("Vertical"); override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { float horizontal = Input.GetAxis ("Horizontal"); float vertical = Input.GetAxis ("Vertical"); Vector2 input = new Vector2(horizontal, vertical).normalized; animator.SetFloat(m_HashHorizontalPara, input.x, m_Damping, Time.deltaTime); animator.SetFloat(m_HashVerticalPara, input.y, m_Damping, Time.deltaTime); } }