Projectiles hit in weird place

I am currently working on a Platformer. If clicked onto an enemy it gets marked an then regularly shot at. The problem is my projectiles don´t hit in the middle of the collider, but at the left top. How do I center them?
Here is my code for shooting:

if (currentTarget != null && currentTarget.getAlive())
        {
            Vector3 spawnPosition = transform.position * spawnDistance;
            BoxCollider2D targetCollider = currentTarget.GetComponent<BoxCollider2D>();
            Vector2 targetCenter = (Vector2)currentTarget.transform.position + targetCollider.offset;
            GameObject projectile = Instantiate(projectilePrefab, spawnPosition, Quaternion.identity); 
            Vector2 shootingDirection = (targetCenter - (Vector2)spawnPosition).normalized;
            Rigidbody2D rb = projectile.GetComponent<Rigidbody2D>(); 
            rb.velocity = shootingDirection * projectileSpeed; 
        }

And here is an image to show the collider:

Thanks in advance :slight_smile: