I have been making game in which you can go upstairs and when you press w MoveTowards will move you in the middle of stairs. Everything is working perfectly but i cant stop MoveTowards when animation stops and player is in middle of stairs. But MoveTowards still pulls me inside and player can´t move.
This is code that pulls player:
if(entered == 1 && klikw == 1)
{
col.SetActive(true);
Vector3 a = transform.position;
Vector3 b = location.position;
transform.position = Vector3.MoveTowards(a, b, speed);
animator.SetFloat("whenhewalk", 1);
}
klikw is when player clicks w