Question by
Squeekpro107 · Feb 18, 2017 at 06:06 AM ·
c#animationunity 5
Crossfadeanimations dont play
i have this for my animations for hands and it just crossfades to the postition to start the animation but doesnt do the animation apart from the fire one.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HandAnimations : MonoBehaviour {
public GameObject FPSARMS;
private float stopRunAnimation = 0.5f;
void Update () {
var directionVector = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
if (Input.GetMouseButton (0)) {
FPSARMS.GetComponent<Animator> ().Play ("Fire");
} else {
if ((directionVector.x > stopRunAnimation || directionVector.x < -stopRunAnimation) ||
(directionVector.y > stopRunAnimation || directionVector.y < -stopRunAnimation) ||
(directionVector.z > stopRunAnimation || directionVector.z < -stopRunAnimation)) {
FPSARMS.GetComponent <Animator> ().CrossFade ("Walk", 0.2f);
} else {
FPSARMS.GetComponent<Animator> ().CrossFade ("Idle", 0.2f);
}
}
}}
Comment
Your answer
Follow this Question
Related Questions
How too climb a ladder with the FPS Controller correctly 0 Answers
MobController 1 Answer
how to link URL into multiple buttons in a condition "if" 1 Answer
Animation won't stop (Solved) 2 Answers
Animator Is Not A Playable Error. 1 Answer