I was trying to animate a dragon with the legacy animation system. And i'm having a couple problems. I want to have the animation crossfade into idle, if its not in an animation, but I can't get him to finish any animations if this is done.(He'll start the animation but then immediately crossfade into "idle". Can anyone give me some pointers on how to finish the animation before he goes into an idle state?
Just an update on this. I've managed to get the animations to finish part way before going into idle by putting `(animation.CrossFade("idle",.9);` but it only works for about half the animation. This seems like it would probably be a common problem. If any veterans have an idea please let me know.
using UnityEngine;
using System.Collections;
public class Animation_Controller : MonoBehaviour
{
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
if(Input.GetKey("w") || Input.GetKey ("s") || Input.GetKey("a") || Input.GetKey ("d"))
{
if(!animation.IsPlaying("fly"))
{
animation.Play ("walk");
}
}
else if(Input.GetKey ("left shift"))
{
animation.Play ("groundStomp");
}
else if(Input.GetKeyDown("space") && !animation.IsPlaying("fly"))
{
animation.Play ("fly");
}
else if (Input.GetKeyDown("space") && animation.IsPlaying("fly"))
{
animation.Play ("land");
}
else if (Input.GetMouseButton(0))
{
animation.Play("stand_breath");
}
//else
//{
//animation.CrossFade("idle");
//}
}
}
↧