What I am trying to achieve is to get the tip of the wave to point at the targets direction.
public void SpawnWave(GameObject WaveBullet, Vector3 TargetPosition, float bullets = 7)
{
float angle = 180f / bullets;
Vector3 direction = (TargetPosition - this.transform.position).normalized;
// use a loop to instantiate the prefabs around the half circle
for (int i = 0; i < bullets; i++)
{
// calculate the current angle
float currentAngle = angle * i;
// calculate the x and z positions of the prefab based on the radius and current angle
float x = 5 * Mathf.Cos(currentAngle * Mathf.Deg2Rad);
float z = 5 * Mathf.Sin(currentAngle * Mathf.Deg2Rad);
Vector3 position = new Vector3(x, 0, z);
Quaternion rotation = Quaternion.LookRotation(direction,this.transform.up);
Instantiate(WaveBullet, position + this.transform.position, rotation);
}
}