void FixedUpdate() { if (isDead) { return; } if (ai.FlapWings(transform.position.x, transform.position.y) || Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space)) { //...tell the animator about it and then... anim.SetTrigger("Flap"); //...zero out the birds current y velocity before... rb2d.velocity = Vector2.zero; rb2d.AddForce(new Vector2(0, upForce)); } }