Hi so Iv’e been working on this game for a game jam and while setting up the animations i encountered this problem:

(The character doesn’t end in the direction they’re walking in when they stop)
Id love all the help i could get as I’m really pressed for time! ![]()
PlayerController script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Controller2D : MonoBehaviour {
public float Speed;
private Animator anim;
private bool playerMoving;
private Vector2 lastMove;
// Use this for initialization
void Start ()
{
anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update ()
{
playerMoving = false;
float Dirx = Input.GetAxis("Horizontal") * Speed * Time.deltaTime;
transform.position = new Vector2(transform.position.x + Dirx, transform.position.y);
lastMove = new Vector2(Input.GetAxis("Horizontal"), 0f);
if (Input.GetAxis("Horizontal") > 0)
{
playerMoving = true;
}
if (Input.GetAxis("Horizontal") < 0)
{
playerMoving = true;
}
anim.SetFloat("MoveX", Input.GetAxisRaw("Horizontal"));
anim.SetBool("PlayerMoving", playerMoving);
anim.SetFloat("LastMoveX", lastMove.x);
}
}
Other helpful screenshots ![]()
PlayerMovement blend tree


