사인,코사인 활용(탄막슈팅-산탄총)

2023. 2. 9. 17:34Public/Math

public float angle;
public int cnt;//갯수
while(IsVaildCondition())
{
   float gap = cnt > 1 ? angle / (float)(cnt - 1) : 0;
   float startAngle = -angle / 2.0f;
   for(int i =0;i<cnt;i++)
   {
     float theta = startAngle + gap * (float)i;
	 theta *= mathf.deg2Rad;
	 GameObject go = Instantiate (bullet,bulletPoint.position, . . . );
	 go.GetComponent<Simplebullet>().SetNormalizedDirection(new Vector3(Mathf.Cos(theta),Mathf.Sin(theta),0);
   }
}