Unity 2022.3.5f1 + Oculus Integration 56.0 (Create a Curved or Flat UI)

VR/Oculus Integration 2023. 10. 4. 15:36
반응형

Interaction SDK에는 곡선 UI와 평면 UI를 위한 프리팹이 있습니다. 서로 다르게 보이지만 기능은 동일합니다.

 

프리팹에는 Poke 상호 작용을 통해 스와이프 또는 스크롤하고 버튼을 선택하는 기능이 포함되어 있습니다.

 

플랫 UI를 만들려면 FlatUnityCanvas 프리팹을 추가하세요. 곡선형 UI를 만들려면 CurvedUnityCanvas 프리팹을 추가하세요

 

Choose a UI Type

 

기본 만들기 

 

계층 구조에서 계층 구조를 마우스 오른쪽 버튼으로 클릭하고 빈 생성을 선택하여 CanvasModule이라는 빈 GameObject를 추가합니다.

 

Inspector에서 구성 요소 추가 버튼을 클릭하고 Pointable Canvas Module을 검색하여 Pointable Canvas 모듈을 추가합니다.

 

다음 중 하나 또는 둘 다를 수행합니다

 


Add a Flat UI Prefab

프로젝트에서 FlatUnityCanvas를 검색하세요.

FlatUnityCanvas 프리팹을 검색 결과에서 계층 구조로 드래그하세요.

 

 

이상태로 빌드 하면 버튼 못누름.

 

Poke를 추가 해야 할듯 

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

 

HandPokeInteractor프리팹 찾아서 넣어주고 Interactors에 추가 

 

 

OVRControllers제거 하고 OVRControllerHands로 변경 

 

빌드후 실행 결과 보기 

잘 동작 함 

 

 

 

UI내부 구조 뜯어 봐야 함 

최상위 

그 자식으로 Canvas가 있음 Render Mode가 World Space임 

Plane Surface가 붙어 있다.

 

 

그 밑에 스크롤뷰 

스크롤뷰 밑에 뷰포트

뷰포트 밑에 콘텐츠

그 밑에 아이템들

일반적인 스크롤뷰 만드는거랑 비슷한듯 

 

이건 따로 테스트 해봐야 겠음 

 


Add a Curved UI Prefab

 

프로젝트에서 CurvedUnityCanvas를 검색하세요

검색 결과에서 CurvedUnityCanvas 프리팹을 계층 구조로 드래그하세요. 곡선 UI가 장면에 나타납니다.

빌드후 실행해보기

 

 

 

 


Use a Ray Interaction with a UI

https://developer.oculus.com/documentation/unity/unity-isdk-use-ray-with-ui/

 

기본적으로 곡선형 또는 평면 UI 만들기에 설명된 UI 프리팹은 Poke 상호 작용을 지원합니다.

그러나 찌르기는 물리적으로 접근할 수 있는 UI에만 작동합니다.

손이 닿지 않는 UI와 상호 작용하려면 UI 프리팹에 Ray Interactable을 추가한 다음 해당 속성을 설정해야 합니다.

 

이렇게 하면 레이캐스트를 사용하여 멀리 있는 UI에 도달할 수 있습니다. 사전 구축된 장면에서 광선 상호 작용을 시도하려면 RayExamples 장면을 참조하세요.

 

Before You Begin

 

 

Add a Ray Interactable Component

곡선 또는 평면 UI 만들기 튜토리얼에서 추가한 곡선 또는 평면 UI 프리팹이 포함된 Unity 장면을 엽니다.

계층 구조에서 UI 프리팹을 선택합니다.

 

Inspector에서 Add Component 버튼을 클릭하고 Ray Interactable을 검색하여 Ray Interactable 구성 요소를 추가합니다.

 

 

Set the Properties

Ray Interactable 구성 요소에서 Pointable Element 속성을 CurvedUnityCanvas로 설정합니다(메시지가 나타나면 PointableCanvasMesh 선택).

 

Set the Surface property to Cylinder.

 

 

이렇게 멀티플도 됨 

 

 

Adding Hand Ray Interactors for Hands

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

HandRayInteractor찾아서 Left/RightHand에 넣어주고 

HandInteractorsLeft/Right에 등록 

 

 

Adding Hand Ray Interactors for Controllers as Hands

Under Project, search for HandRayInteractor, and drag the HandRayInteractor prefab from the search results into the Hierarchy onto OVRInteraction > OVRControllerHands > LeftControllerHand > ControllerHandInteractors.

 

Using a ray interaction to interact with a curved canvas and a flat canvas.

To share a cylinder between multiple canvases, see the RayExamples scene.

 

Example Scenes | Oculus Developers

 

developer.oculus.com

 

 

 

 


관련 주제

  • To learn how to interact with a UI via a raycast, see Use a Ray Interaction with UI.
  • To learn about the components of a Poke interaction, see Poke Interactions.
  • For an interactive example of raycasting with multiple UI prefabs, see the RayExamples scene.
  • To learn about the different types of surfaces in Interaction SDK, see Surfaces.
  • To learn about components that define the interactable surface of UI elements, see Surface Patch.

참고

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

반응형
: