- Home /
Unity script and animation not working?
Ok, I followed this tutorial thoroughly - https://www.youtube.com/watch?v=HjkFfkHCgCc, and I have a walk/run animation that is great. However, I wish to add to it, like an attack animation specifically. I have downloaded several animations that would be perfect, but they don't work when I add them to my character and update my script. Here is the script - var animator : Animator; var v : float; var h : float; var sprint : float;
function Start () {
animator = GetComponent(Animator);
}
function Update ()
{
v = Input.GetAxis("Vertical"); h = Input.GetAxis("Horizontal"); Sprinting();
}
function FixedUpdate(){
animator.SetFloat ("Walk", v); animator.SetFloat ("Turn", h); animator.SetFloat("Sprint", sprint);
}
function Sprinting (){ if(Input.GetButton("Fire1")){ sprint = 0.2; } else{
sprint = 0.0; }
}
And I'm trying to add this to it - function Update() { if(Input.GetKeyDown("g")) { animation.Play("143_24", PlayMode.StopAll); } }
But I get errors all the time? I don't see what the problem is. I add the animation to animator controller and make transitions. I've even tried adding it as just a regular animation. I've tried animating my makehuman model in blender, but it seems impossible with the bone structure. Is it even possible to animate a makehuman model past the walk cycle? All I want is to know to make an attack animation for it. Help is much appreciated.
Your answer
