Unity 2022.3.5f1 + Oculus Integration 56.0 (Create Locomotion Interactions)

VR/Oculus Integration 2023. 10. 2. 23:39
반응형

손, 컨트롤러를 손으로 사용하거나 컨트롤러를 사용하여 순간 이동하거나 스냅 회전하려면 LocomotionHandInteractorGroup 프리팹에 포함된 이동 상호 작용을 사용합니다.

 

 To try locomotion interactions in a pre-built scene, see the LocomotionExamples scene.

 

Add Locomotion Interactors

이동 인터랙터를 사용하면 이동 상호 작용 가능 개체 또는 순간 이동을 허용하는 장면의 다른 영역으로 순간 이동을 트리거할 수 있습니다.

Adding Locomotion Interactors for Hands

Under Project, search for LocomotionHandInteractorGroup, and drag the LocomotionHandInteractorGroup prefab from the search results onto OVRInteraction > OVRHands > LeftHand > HandInteractorsLeft. The prefab contains all the components needed for locomotion to work out of the box.

 

 

  1. Under Inspector, in the Hmd Ref component, set Hmd to OVRHmd.

 

 

In the Active State Finger Visual component, set Hand Material Property Block Editor to the l_HandMeshNode under HandVisualsLeft > OVRLeftHandVisual > OculusHand_L.

 

 

오른손도 똑같이 함 

 

Adding Locomotion Interactors for Controllers

  1. In a separate Unity window, open the LocomotionExamples scene.
  2. Under Hierarchy, copy the Locomotion GameObject that’s under OVRInteraction.

컨트롤러를 설정한 Unity 장면으로 다시 전환합니다.

Paste the Locomotion GameObject into the same location in the Hierarchy (under OVRInteraction).

 

 

Player Locomotor 구성 요소에서 Player Origin을 OVRCameraRig로 설정합니다.

 

 

  1. Set Player Head to CenterEyeAnchor.

 

 

 

 

 

Under Project, search for LocomotionControllerInteractorGroup, and drag the LocomotionControllerInteractorGroup prefab from the search results onto OVRInteraction > OVRControllers > LeftController > ControllerInteractors. The prefab contains all the components needed for locomotion to work out of the box.

 

  1. Under Hierarchy, select LocomotionControllerInteractorGroup.
  2. Under Inspector, in the Hmd Ref component, set Hmd to OVRHmd.
  3.  

 

In the Locomotion Events Connection component, set Handler to Locomotion.

 

 

Under Hierarchy, under LeftController, create a GameObject called ControllerFeatures

.

 

 

  1. Under Inspector, add an OVR Axis 2D component.
  1. Set Controller to L Touch, L Hand.

 

Set Axis 2D to Primary Thumbstick, Primary Touchpad.

 

 

 

 


 

Hands를 선택 하면 L Hand, R Hand를 선택 할수 있게 되는데 왜 안되는 걸까...?

일단 L Touch , R Touch만...

 


Under Hierarchy, select LocomotionControllerInteractorGroup > TeleportControllerInteractor > TeleportActiveState > Activate.

 

 

 

 

Under Inspector, in the Axis 2D Active State component, set Input Axis to ControllerFeatures.

 

 

 

 

  1. Under Hierarchy, select Deactivate, which is a sibling of Activate.

 

  1. Under Inspector, in the Axis 2D Active State component, set Input Axis to ControllerFeatures.

 

Under Hierarchy, select LocomotionControllerInteractorGroup > TeleportControllerInteractor > Selector

Under Inspector, in the Axis 2D Active State component, set Input Axis to ControllerFeatures.

 

 

  1. Under Hierarchy, select LocomotionControllerInteractorGroup > ControllerTurnerInteractor.

Under Inspector, in the Locomotion Axis Turner Interactor component, set Axis 2D to ControllerFeatures.


Add Locomotion Interactable

텔레포트 인터랙터를 구성한 후에는 텔레포트할 지점을 추가해야 합니다.

 

  1. Under Project, search for TeleportHotspot, and drag the TeleportHotspot prefab from the search results into the Hierarchy.

 

 

Using the Transform gizmos in the Scene view, place the prefab in a spot you want to teleport to.

 


사용자가 해당 지역 내 어디든 순간 이동할 수 있도록 순간 이동 가능한 영역과 범위 밖을 정의할 수 있습니다. 이렇게 하려면 LocomotionExamples 장면의 NavMeshHotspotWalkable 및 HotspotVoidFloor를 장면에 복사합니다.

 


 

파일 > 빌드 및 실행을 선택하거나 Oculus Link가 연결된 경우 재생을 클릭합니다.

 

현재 장면이 로드되면 손으로 L자 모양을 만들거나 컨트롤러의 조이스틱을 앞으로 누릅니다. 손이나 컨트롤러에서 흰색 광선이 방출됩니다.

 

TeleportHotspot 또는 순간 이동 가능한 영역 위로 마우스를 가져간 후 엄지와 검지를 집거나(손을 사용하는 경우) 조이스틱을 놓으면(컨트롤러를 사용하는 경우) 해당 위치로 순간 이동합니다.

 


모가 잘못 된걸까....

컨트롤러는 일단 나오고 손은 왼손만 나옴..

 

HandInteractorsLeft/Right에 interactors에 추가 안해서...?

일단 양쪽 추가 하고 다시 빌드 시도 

 

이건 처음 보는 현상...

 

다시 체크 

OVRHandPrefab이 둘다 있고 HandType이 잘 설정 되었나?

 

HandInteractorsLeft/Right에 LocomotionHandInteractorGroup이 있고 

BestHoverInteractorGroup에 Interactors 필드에 추가 되었나?

 

 

LocomotionHandInteractorGroup의 HmdRef의 Hmd 필드에 OVRHmd가 할당 되었나?

 

 

뭐가 문제일까....?

 

일단 Locomotion관련 오브젝트들을 비활성화 해봄 

 

 

컨트롤러도 잘 나오고 손도 잘 나옴 

 

그럼 Locomotion쪽 설정 문제가 확실 

 

예제를 까보기로 함 

두군데가 비어 있음 

 

 

 

 

 

 

 

 

 

 

왼쪽 컨트롤러 Thumb스틱으로 회전과 텔레포트 성공 

 

오른쪽 컨트롤러 동작 안함 

 

핸드 트레킹으로 텔레포트 성공 , 회전안됨

 

다시 찾으러...

 

 

 

예제 분석 

샘플

 

 

OVRControllerPrefab 이 없어도 된다는거 

핸드 트래킹 및 컨트롤러 as 핸드 사용할때 OVRHandPrefab이 필요 했는데 

컨트롤러는 왜 필요 없는거지...?

일단 제거후 빌드 및 실행 

 

일단 없어도 핸드 트래킹이라 컨트롤러 잘 나옴 (있어도 잘 나옴)

 

thumbstick으로 텔레포트 가이드 안나옴 (위 문제는 아닌듯)

 

OVRInteraction쪽인거 같은데 

샘플

 

Hand는 잘 동작 하니 RightController만 확인 

샘플

 

 

ControllerInteractors에 LocomotionControllerInteractorGroup와 ControllerPokeInteractor가 있는데 상관 없어 보인다 

Hand쪽도 LocomotionControllerInteractorGroup만 넣고 했는데 잘됨 ControllerPokeInteractor는 Poke 인터렉션 할때 필요 

샘플

 

LocomotionControllerInteractorGroup의 모든 필드가 할당되어 있음 

 

 

자식 오브젝트인 TeleportControllerInteractor 컴포넌트의 필드 들도 모두 할다되어 있음 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

잉? OVRControllerPrefab이 왜 여기 이찌??

 

 

 

R Touch, R Hand 아마 이거 때문인거 가튼데 R Hand 어떻게 선택 했냐 

심지어 Hands 체크도 안되어 있네 

 

LeftController/ControllerFeatures도 L Touch, L Hand선택되어 있네...

 

 

모지 ????

 

 

Hands를 선택해 버리면 이렇게 되는데 .... 이거원래 Hands선택 하면 L Hand, R Hand 둘중 하나 또는 모두 선택 가능하게 바꼈었는데 왜 안바뀌냐 

모냐...

샘픔

맞자녀 Flags 애트리뷰트 .. LHand랑 RHand 으디 가때 

 

근데 더 아상한건 지금 핸드 트래킹 제스쳐로 양손다 텔레 가능 하단 말야 

LHand, RHand가 설정 안되어 있고 L Touch, R Touch만 설정되어 있는데도 말이다..

그럼 컨트롤럴로 양쪽 가능 하고 핸드 트래킹할때 안되야 맞는거 아닌가?

 

 

이게 나의 셋팅

애초 L Hand, R Hand가 읍음 

 

Hands선택 하면 L Hand, R Hand 모두 들어감 -_-;;

 

일단 넣고 빌드 해본다 

 

역시 될리가 읍다 

 

 

 

샘플에 있는 Controller 프리팹 가져와서 해봄 

 

 

 

너무 잘됨...

 

그리고 L Hand, R Hand 빼고  해봄

 

 

역시 너무 잘됨 

 

아니 모냐고..

샘플
내꺼

 

 

 

 

내꺼

 

샘플

 

 

 

내꺼

 

 

샘플

 

 

 

 

찾은거 같네...

이게 왜 빠져 있지..

내꺼

 

샘픔

 

 

음..저걸 체크 안했을리가 읍는데..

여튼 다 채워 넣고 빌드 후 실행 

 

컨트롤러 양쪽다 텔레 포트 가능 그런데 핸드 트래킹 쪽이 문제 

결국 Hands를 추가 

 

잘동작 한다 

 

 

 

 

핸드 트래킹에서 스냅 턴 안되는 이유는 뭘까...?

 

TurnerInteractor의 Locomotion Turner Interactor 컴포넌트의 Transformer필드가 빠져 있었음 

여기에 OVRInteractor를 넣어 주면 잘 동작 한다 

 

 

아니 이걸 어떻게 아냐고 ㅋㅋㅋ 

샘플 없으면 이거 가이드문서에도 없고 어떻게 만드냐고 ㅋ

XRTollkit에 비해 여러가지 편리한 기능을 미리 만들어 논거 잘좀 문서좀 만들어 놓지...

 

암튼 성공 


참고

https://developer.oculus.com/documentation/unity/unity-isdk-create-locomotion-interactions/

반응형
: