for any reason my falling anim is infinite and doesnt stop even if im on the ground and i am trying for hours pls someone help me
i removed some coding that doesnt interest cuz discord char limit
public class Move : MonoBehaviour
{
private Animator animator;
float Speed = 5;
protected Rigidbody2D rb;
public Transform groundCheck;
public float groundCheckRadius = 0.5f;
public LayerMask groundLayer;
float Horizontal;
public float jumpForce = 10f;
private bool isGrounded;
void Start()
{
rb = GetComponent<Rigidbody2D>();
animator = GetComponent<Animator>();
canDash = true;
}
void Update()
{
float Move = Input.GetAxisRaw("Horizontal");
rb.velocity = new Vector2(Move * Speed, rb.velocity.y);
if(Input.GetKeyDown(KeyCode.Space) && isGrounded)
{
rb.velocity = new Vector2(rb.velocity.x, jumpForce);
}
SetAnimation(Move);
if (Input.GetKeyDown(KeyCode.LeftShift) && canDash)
{
Debug.Log("esse outro");
StartCoroutine(Dash());
}
Debug.Log(Move);
}
private void FixedUpdate()
{
isGrounded = Physics2D.OverlapCircle(groundCheck.position, groundCheckRadius, groundLayer);
}
private void SetAnimation(float Move)
{
animator.SetFloat("Speed", Move);
if (isGrounded){
if (Move == -1){
transform.localScale = new Vector3(-1, 1, 1);
}
else if(Move == 1){
transform.localScale = new Vector3(1, 1, 1);
}
}
if (!isGrounded)
{
if (rb.velocity.y > 0.1f)
{
animator.Play("Falling");
}
else if (rb.velocity.y < 0.1f)
{
animator.Play("Jumping");
}
return;
}
}