I wanna animate my snowboarder when he is jumping. Currently my code looks like this
private void OnCollisionEnter2D(Collision2D other) {
if (other.collider.tag=="Ground"){
myAnim.SetBool("isGrounded" , true);
}
}
private void OnCollisionExit2D(Collision2D other) {
if (other.collider.tag=="Ground"){
myAnim.SetBool("isGrounded" , false);
}
}
The problem is that it plays the animation every milisecond the player is not touching the ground so it looks like he’s having a seizure.
I want it so that the animation plays only when the player has covered a certain distance in the y direction. How do i approach the problem?