강의

멘토링

커뮤니티

Inflearn Community Q&A

happylhc70237's profile image
happylhc70237

asked

Game Development with Unity: Part 3. Shooting Game Development

Use coin prefab

randomPos

Resolved

Written on

·

174

0

안녕하세요 강사님 질문있습니다.

행성이 파괴되어 코인이 생성시

위치를 작은 값을  랜덤으로 구해서 생성하는거와

행성의 현 위치에 생성하는 차이가 궁금합니다.

Vector3 randomPos = new Vector3(Random.Range(-0.1f, 0.1f), Random.Range(-0.1f, 0.1f), 0);

                Instantiate(coinObj, transform.position + randomPos, Quaternion.identity);

/////////////////////////////////////////////////////////

Instantiate(coinObj, transform.position, Quaternion.identity);

제가 단순 행성 위치에서 코인 생성을 해봤는데 차이점을 모르겠습니다.

C#unity

Answer 1

1

UDevApp님의 프로필 이미지
UDevApp
Instructor

사실 큰 의미는 없습니다

코인이 적 오브젝트 위치에서 바로 생기는 것이 아니라 조금 옆으로 생겨서 동적인 느낌을 주고 싶어서 그랬습니다

감사합니다

happylhc70237's profile image
happylhc70237

asked

Ask a question