Che dire, semplicemente ho connesso ho creato un'animation controller e ci ho creato una transizione per 4 animazioni diverse con un Blend Tree, ora però
L'animazione non cambia nel momento in cui mi muovo, come dovrebbe, ma quando l'animazione corrente termina.
Ecco il codice:
Codice: Seleziona tutto
using UnityEngine;
using System.Collections;
public class PlayerMovement : MonoBehaviour {
public float playerHorMovement;
public float playerVerMovement;
public float playerMovementSpeed = 0.025f;
public Animator playerAnimat;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
playerHorMovement = Input.GetAxis("Horizontal") * playerMovementSpeed;
playerVerMovement = Input.GetAxis("Vertical") * playerMovementSpeed;
transform.Translate(-playerVerMovement, 0, playerHorMovement, Space.Self);
}
void FixedUpdate() {
Animating();
}
void Animating() {
bool animWalkingBlend = playerHorMovement != 0 || playerVerMovement != 0;
playerAnimat.SetBool("IsWalking", animWalkingBlend);
playerAnimat.SetFloat("FB", playerVerMovement);
playerAnimat.SetFloat("LR", playerHorMovement);
}
}