public void Fire()
{
float a = Random.Range(-1.0f, 1.0f);
float b = Random.Range(-1.0f, 1.0f);
GameObject temp = Instantiate(mortarshell, muzzle.remove_style_tag;"> mortarshellList.Add(temp);
for(int i=0;i<mortarshellList.Count;i++)
{
mortarshell _mortarshell = mortarshellList[i].GetComponent<mortarshell>();
_mortarshell.start = muzzle;
_mortarshell.end = mortarRange;
}
}
---------------------------------------------------------------------------------------------
ย public void Fire()
ย ย {ย ย ย ย ย
ย ย ย ย float a = Random.Range(-1.0f, 1.0f);
ย ย ย ย float b = Random.Range(-1.0f, 1.0f);
ย ย ย ย GameObject temp = Instantiate(mortarshell, muzzle.position, Quaternion.identity);
ย ย ย ย mortarshellList.Add(temp);
ย ย ย ย for(int i=0;i<mortarshellList.Count;i++)
ย ย ย ย {
ย ย ย ย ย ย mortarshell _mortarshell = mortarshellList[i].GetComponent<mortarshell>();
ย ย ย ย ย ย _mortarshell.start = muzzle.transform.position;
ย ย ย ย ย ย _mortarshell.end = mortarRange.transform.position + new Vector3(a,b,0);ย
ย ย ย ย }ย ย ย
ย ย }
๋ฐ์ ์ง๋ฌธ๊ธ ์ฌ๋ฆฌ๋๊นย _mortarshell.start๋ย _mortarshell.end ์ด๊ฑธ ํธ๋์คํผ์์ ๋ฒกํฐ3์ผ๋ก ๋ฐ๊ฟ์ ํ๋ผ๊ณ ํด์ ๋ฐ๊พธ๊ธด ํ๋๋ฐ
์๋ฐ๊พธ๊ณ ์์ ํ๋ค๋ฉด ์ด๋ป๊ฒ ์ง์ผํจ?
์ ๋ฒ๋ถํฐ ์๊พธ ์ฝ๋์ค๊ฐ์ jsx๊ฐ์๊ฒ ์ฝ์ ๋๋๊ฑฐ๊ฐ์๋ฐ ์๋ ์คํฌ๋ฆฝํธ๊ฐ ์ ์ผ์๊ฒผ์?
transform.position => ๋ฒกํฐ3, ์ ๋์ขํ, transform.rotation => Quarternion, ๋กํ ์ด์ ๊ฐ, transform.scale => ๋ฒกํฐ3, ์ค์ผ์ผ ๊ธฐ๋ณธ์ ์ผ๋ก ์ ๋ํฐ ๊ฒ์์ค๋ธ์ ํธ๊ฐ ๋ค๊ณ ์๋ ๊ฐ๋ค์ด์ผ. ์ ๋ํฐ ํํ ๋ฆฌ์ผ ํ๋ฒ ๋ณด๋๊ฒ ์ข์๊ฑฐ ๊ฐ๋ค