Projectile changes direction and angle

I set up a fireball projectile to move based on my player’s facing direction, and while it works for the most part there are a couple kinks that I just can’t figure out. The main thing is changing direction of the player causes the fireball to change direction. I am hoping maybe I can get assistance to solve this.

The other issue is that the fireball sometimes moves at an angle instead of a straight line, this isn’t
as huge an issue but it is something I would like to fix as well.

//This code is attached to my player
public void CastSpell()

           Instantiate(spellPrefab[0], exitPoints[exitIndex].position, Quaternion.identity);



this code is attached to my fireball prefab

 private void FixedUpdate()

        GameObject myPlayer = GameObject.Find("Player");
        Player aplayer = myPlayer.GetComponent<Player>();


        Vector2 moveDirection = gameObject.transform.position - aplayer.transform.position;
        myRigidBody.velocity = moveDirection.normalized * speed;
         if (moveDirection !=

            float angle = Mathf.Atan2(moveDirection.y, moveDirection.x) * Mathf.Rad2Deg;
             transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward * speed);


The fireball changes direction because you have your code in FixedUpdate, which is called (before) every frame, so your fireball will update it’s direction