์œ ๋‹ˆํ‹ฐ ๋ฑ€์„œ๋ผ์ดํฌ ๋งŒ๋“œ๋Š” ๊ฐ•์˜ ์˜์ƒ ๋ณด๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
ํ”Œ๋ ˆ์ด์–ด ์บ๋ฆญํ„ฐ์— ์ž์‹ ๊ฐ์ฒด๋กœ ๋ฌด๊ธฐ ๋ฐฐ์น˜ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋งŒ๋“ค๊ณ  ๊ทธ ์˜ค๋ธŒ์ ํŠธ์— ๋„ฃ์„ ์Šคํฌ๋ฆฝํŠธ์—์„œ
๋ฌด๊ธฐ๋ฅผ ๋ฐฐ์น˜ํ•˜๋Š” C# ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์“ฐ๊ณ  ์žˆ์—ˆ๋Š”๋ฐ ์—ฌ๊ธฐ์„œ


//๋ฌด๊ธฐ ๋ฐฐ์น˜ ํ•จ์ˆ˜

void Batch()

{

for (int index = 0; index< count; index++){

Transform bullet =

GameManager.instance.pool.Get(prefabId).transform;

bullet.parent = transform; //๊ฐ€์ ธ์˜จ ์ด์•Œ์˜ ๋ถ€๋ชจ๋ฅผ ๋‚˜๋กœ ๋ฐ”๊ฟˆ

Vector3 rotVec = Vector3.forward * 360 * index / count;

bullet.Rotate(rotVec);

bullet.Translate(bullet.up * 1.5f, Space.World);

bullet.GetComponent<Bullet>().Init(damage, -1); // -1 is Infinity Per

}

}

์—์„œ ์ผ๋ถ€ ๊ฐ€์ ธ์™€์„œ ์ด ๋ถ€๋ถ„

bullet.Rotate(rotVec);

bullet.Translate(bullet.up * 1.5f, Space.World);

bullet.GetComponent<Bullet>().Init(damage, -1); // -1 is Infinity Per

์—์„œ Translate๋ฅผ ํ• ๋•Œ Space.World๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•˜๋Š” ์ด์œ ๊ฐ€ ๋ญ”์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.
์ œ๊ฐ€ ์•Œ๊ธฐ๋ก  ๋ฌด๊ธฐ๋ฅผ ํšŒ์ „์‹œ์ผฐ๋‹ค ํ•˜๋”๋ผ๋„ Space.World ํšŒ์ „๊ณผ ๊ด€๊ณ„์—†์ด ์ด๋™๋˜๋‹ˆ๊น ์œ„์ชฝ ํ•œ๊ณต๊ฐ„์— ๋ฌด๊ธฐ๋“ค์ด ๊ฒน์ณ์•ผ ํ•  ๊ฑฐ ๊ฐ™์€๋ฐ
์›ํ•˜๋Š”๋Œ€๋กœ ์ž˜ ๋‚˜์˜ค๋‹ˆ ์›๋ฆฌ๊ฐ€ ๊ถ๊ธˆํ•ด์„œ ์งˆ๋ฌธ๋“œ๋ฆฝ๋‹ˆ๋‹ค.


a17d2cad2f1b782a99595a48fa9f3433f728bd6f6b8abd3f6e52a8ff