Enemy jump to player position then stop?
Hi, I have programed an enemy that when hit moves back slightly, then jumps a set distance towards the player. Is there a way I can get the enemy to follow the players position while in the air so that they land near the player before they hit the ground? Any help is appreciated. void OnCollisionEnter(Collision col) { if (col.gameObject.tag == "playerProjectile") { lookAtPlayer(); currentHealth--; rb.velocity -= transform.forward * 10; Debug.Log("Enemy shield down"); if (grounded) { StartCoroutine("attack"); } } } IEnumerator attack() { yield return new WaitForSeconds(0.7f); lookAtPlayer(); //rb.velocity = (transform.up * 6.5f) + Vector3.MoveTowards(player.transform.position, new Vector3(player.transform.position.x, 0, player.transform.position.z), Time.deltaTime * 2); if (grounded) { rb.velocity = (transform.up * 15f) + transform.forward * 5; } StartCoroutine("grabWindow"); }