4 4 Vector Vector 2 Vector 2x y

  • Slides: 23
Download presentation

4. 4 유니티의 Vector - Vector 2 : 평면의 위치, Vector 2(x, y) -

4. 4 유니티의 Vector - Vector 2 : 평면의 위치, Vector 2(x, y) - Vector 3 : 공간의 위치, Vector 3(x, y, z) - Vector 4 : 4개의 값, Vector 4(r, g, b, a)

4. 9 오브젝트의 낙하 - Plane과 Sphere를 추가 - Sphere에 Rigidbody추가. Component > Physics

4. 9 오브젝트의 낙하 - Plane과 Sphere를 추가 - Sphere에 Rigidbody추가. Component > Physics > Rigidbody

4. 10 오브젝트의 반사 - Project뷰에서 Create > Physic Material 추가. 이름을 Bouncy로 변경

4. 10 오브젝트의 반사 - Project뷰에서 Create > Physic Material 추가. 이름을 Bouncy로 변경 - Sphere에 Bouncy 적용.

4. 13 오브젝트 움직이기 - Cs. Move. cs 생성 int speed=5; // 5 m/s.

4. 13 오브젝트 움직이기 - Cs. Move. cs 생성 int speed=5; // 5 m/s. 속도= 거리/시간 Void Update(){ float amt. Move=speed*Time. delta. Time; transform. Translate(Vector 3. forword*amt. Move); //transform. Translate(new Vector 3(0, 0, 1)*amt. Move); } - 스크립트를 Cube에 연결

4. 14 월드 좌표와 로컬 좌표 - 월드좌표 적용 transform. Translate(Vector 3. forward, Space.

4. 14 월드 좌표와 로컬 좌표 - 월드좌표 적용 transform. Translate(Vector 3. forward, Space. World); - 로컬좌표 적용 transform. Translate(Vector 3. forward, Space. Self); //기본값

4. 15 Key로 이동 및 회전하기 - 좌우 이동 float amt. Move=speed*Time. smooth. Delta.

4. 15 Key로 이동 및 회전하기 - 좌우 이동 float amt. Move=speed*Time. smooth. Delta. Time; float key. Forward=Input. Get. Axis(“Vertical”); //상, 하 키 float key. Side=Input. Get. Axis(“Horizontal”); //좌, 우 키 transform. Translate(Vector 3. forward*amt. Move*key. Forward); transform. Translate(Vector 3. right*amt. Move*key. Side); transform. Translate(new Vector 3(key. Side, 0, key. Forward) * amt. Move);

4. 15 Key로 이동 및 회전하기 - 회전 Int rot. Speed=120; float amt. Rot=rot.

4. 15 Key로 이동 및 회전하기 - 회전 Int rot. Speed=120; float amt. Rot=rot. Speed*Time. smooth. Delta. Time; float key. Rot=Input. Get. Axis(“Horizontal”); //좌, 우 키 transform. Rotate(Vector 3. up*amt. Rot*key. Rot); // y축 기준으로 회전 * Time. smooth. Delta. Time 은 첫 프레임부터 현재프레임까지의 평균 경과시간 을 의미 한다. Time. delta. Time보다 오브젝트의 움직임이 더 부드럽다.