Topdown projectile not facing player on certain positions.

I’m having some trouble make a projectile face the target/player on instantiation. Since it’s a topdown, I want it’s y position to be at 4 and it’s look at for the y position to be always 0 to make sure its going forward and not up or down.

The moving toward player seems to work properly as the sphere represents its position but the pointed cube is not facing the player.

Instantiation:

            Vector3 spawnOffSet = transform.position + Vector3.up * 3f; //This is where the mouth of the raptor is
            projectileScript newProjectile= Instantiate(projectile,spawnOffSet,Quaternion.identity);
            newProjectile.InitiateProjectile(target.position-spawnOffSet,projectSpeed,this.tag); //Pass tags to function.

InitiateProjectile to face target and move tward it.

    public void InitiateProjectile(Vector3 targetPos,float newSpeed,string origin){
        targetPos.y = 0; //Make sure that the projectile stays on its current y axis
        transform.LookAt(targetPos); //Rotate to the target
        moveDirection = targetPos;  // Move to the target;
    }

This subject is marked [Resolved]. Is it resolved? If so, any chance you can make a short note about how you resolved it?

Not really resolved but I ended up making it move based on it’s transform.forward but also adding 0 to the y vector. I did not want to do this since I will have many projectiles at once but I don’t think theres another solution.

transform.position += new Vector3(transform.forward.x,0,transform.forward.z) * projectileSpeed;