์ ๋ํฐ์์ rotation around์๋๊ฑด ์๋๋ฐ
์ด๊ฑฐ ์์ฐ๊ณ ์์น ๊ณ์ฐํด์ ํด๋ณด์ ๋ถ ์์ด์?
์ง๊ธ ์ธ์๊ฐ ์๋ ์ํฉ์
์ ๋ํฐ์์ rotation around์๋๊ฑด ์๋๋ฐ
์ด๊ฑฐ ์์ฐ๊ณ ์์น ๊ณ์ฐํด์ ํด๋ณด์ ๋ถ ์์ด์?
์ง๊ธ ์ธ์๊ฐ ์๋ ์ํฉ์
๊ตณ์ด ๊ณ์ฐํด์ ํ์๋ฉด ์ํ๋ ๊ฐ์ ์ฌ์ธ ์ฝ์ธ์ธ ๊ตฌํด์ ๊ณ์ ํด์ฃผ๊ธฐ๊ฐ ์์ ๊ฒ ๊ฐ์๋..
์นด๋ฉ๋ผ๋ฅผ ๋น๊ธ๋น๊ธ ๋๋ฆฌ๋๊ฑฐ์? TPS ์ฒ๋ผ? ์๋๋ฉด ๋ฌผ์ฒด๋ฅผ ๋น๊ธ๋น๊ธ?
๋ฌผ์ฒด๋น๊ธ๋น๊ธ
x = cos(theta * elapsed time) y = sin(theta * elapsed time) ํ๋ฉด ๋จ
๊ฐ ์ฑ๋ถ์ ๋ฒ์ r ๊ณฑํ๊ณ
+ ์๊ธฐ ์์น๋ ๋ํ๊ณ
์ค
gpt ์ถฉ๋ค์ ์ด๋ฐ๊ฑฐ ์ข ํด๊ฒฐํด์ค๋ด
ํ๋ ์ด์ด ์์ํ๋ ๋ง๋ค์ด์ ์์ ๋น๊ธ๋น๊ธ ๋๋ฆฌ๊ณ ๊ทธ ๋ฐ์ ๋ฃ์ด์ฃผ๊ธฐ
์๊ฒ ์ ์ผ ์ฌ์ด๊ฑฐ ๊ฐ๊ธดํ๋ฐ..
๋ฌผ์ฒด ๋น๊ธ๋น๊ธ์ด๋ฉด ์ด๊ฒ ๊ฐ์ฅ ์ฝ๊ณ ๊ฐ ์์ ๋ ํธํ๊ธด ํ ๊ฒ ๊ฐ์
์๊ฑฐ์ง
void Update(){ // ํ์ฌ ์๊ฐ์ ๊ธฐ๋ฐ์ผ๋ก ํ์ ๊ฐ๋ ๊ณ์ฐ float angle = Time.time * rotationSpeed; // ๊ฐ๋๋ฅผ ๋ผ๋์์ผ๋ก ๋ณํ float radians = angle * Mathf.Deg2Rad; // ํ์ ์์น ๊ณ์ฐ float x = Mathf.Cos(radians) * radius; float z = Mathf.Sin(radians) * radius; // ์ค๋ธ์ ํธ ์์น ์ ๋ฐ์ดํธ transform.position = playerTransform.position + new Vector3(x, 0, z);} ๋ญ ์ด๋ฌ๋ฉด ๋๋ ค๋