본문 바로가기
홀로렌즈2/기본기

유니티에서 홀로렌즈2 개발 - 오브젝트 손으로 잡고 옮기기

by TODAYCODE 2021. 7. 7.
반응형

1. 컴포넌트 추가

RoverAssembly와 Parts를 모두 선택한 다음,

Add Component를 눌러서

Object Manipulator

NearInteractionGrabbable

PartAssemblyController

를 추가해준다.

 

 

2. Object Manipulator 설정

Object Manipulator에서

Two Handed manipulation을 Move와 Rotate만 선택해준다.

 

3. Audio 설정

RoverAssembly와 Parts를 모두 선택한 다음,

Add Component로 Audio Source를 추가해준 뒤

 

MRTK - StandardAssets - Audio 안에 있는

MRTK_Scale_Start를 AudioClip에 넣어준다음에

Play on Awake의 체크를 해제하고

Spatial Blend를 1로 설정해준다.

 

 

4. Location To Place 설정

RoverParts의 Part Assembly Controller에 Location To Place에 드래그앤드롭을 수행한다.

파트별로 각 이름에 맞는 요소들을 넣어준다.

 

 

5. Reset 버튼 설정

Reset 버튼을 선택하고

Interactable의 Onclick()에 RoverAssembly를 드래그앤드롭 해준 뒤

PartAssemblyController.ResetPlacement로 설정해준다.

 

 

 

모든 설정을 끝마친 뒤에 플레이를 해보면

Parts들을 잡고 옮길 수 있게 되었으며

Reset버튼을 눌러서 초기화를 할 수 있다.

 

반응형

댓글