I have my character moving in the world, but I’m having difficulty coming up with a basic system for animations. Ideally I would like to be have the Spawn, Idle, Run, Attack, Die, Respawn.
then you need to create these animations on and for your character and play them at the corresponding times through telling the Animation component to play the right clip
I have the animations and the are setup in animation, but I only have idle playing. I’m not sure how to trigger them to play during a specific action, like walk.
sorry for the noob questions, but still getting familiar with scripting. here is the code that I’m staring with but I’m not sure where to go from here. The character already has movement and character controllers applied, I would just like him to animate while he is moving.
thanks
using UnityEngine;
using System.Collections;
public class AnimationMovement : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.W))
{
animation.CrossFade(“run”);
}
else
{
animation.CrossFade(“idle”);
}
}
}