[UE4] VR에서 Widget에서 물건을 꺼내보세요
12234 단어 위 4OculusRiftVR
(UE4:4.24.1 Oculus Rift와 Touch 사용하고 있습니다.)
[UE4] Widget Interaction 컴퍼넌트를 사용해 VR로 접하는 UI를 제작해 본다!
이쪽의 블로그를 읽어 보고, 문득 Widget Interaction으로부터 물건을 내보낼 수 없는가, 라고 생각해 만들어 보았습니다.

동영상은 여기에서
만드는 방법
Widget의 Spawn에 대해 이 블로그를 참고했습니다.
UE4 : 위젯에서 드래그 앤 드롭으로 액터 스폰
먼저 Widget과 그것을 추가한 Actor를 만듭니다. 위의 블로그와 거의 같은 만들기이므로 세세한 설명은 할애.

이름: WidgetInteraction

이름: BP_WidgetInteraction
이제 Widget Interaction을 BP_MotionController에 추가합니다. 둘 다 "Hidden In Game"을 True로 두십시오. Widget Interaction은 "Enable Hit Testing"을 false로 두십시오.

Widget Interaction은 「Show Debug」를 True로 해 두면 좋을지도
이것들을 표시하기 위한 함수를 만듭니다.




그 후, 「프로젝트 설정」→「인풋」으로부터 액션 인풋에 「VisiblePauseMenu」를 추가해, 적당한 버튼을 할당합니다. 여기에서는 Touch의 Y, B 버튼을 할당했습니다.

MotionControllerPawn으로 이동하여 다음과 같이 BP를 조립합니다.

이런 식으로 Widget을 낼 수 있습니다.

다음으로 Spawn하는 용의 Actor를 만들어 갑니다. 이름은 'BP_SM'입니다. 여기도 상기의 블로그와 거의 같은 만들기이므로 세세한 것은 할애.


BP_MotionController로 돌아가서 BP_SM을 Attach하기 위한 SphereCollision을 추가합니다. 크기는 작고, 콜리전 프리셋을 「NoCollision」으로 하는 것을 잊지 않고.

이벤트 그래프를 열고 다음과 같이 BP를 조립합니다. 여기도 위의 블로그와 거의 같기 때문에 할애.




Widget을 Press하기 위한 함수도 만들어 갑니다. 열거형 「PressReleaseEnum」을 작성해, 이하와 같이 합니다.

"BP_MotionController"로 돌아가서 다음과 같이 함수를 구성합니다.

다음에 Widget을 Press했을 때에 「BP_SM」을 Spawn 시키도록 합니다. 프로젝트 설정 → 입력에서 ActionInput에 PauseMenuPress를 추가합니다. 여기에서는 "Oculus Touch (R) Trigger"를 할당합니다.

MotionControllerPawn을 열고 다음과 같이 BP를 조립합니다. 여기서 함수도 만들고 있습니다만, 이것은 Widget으로 처리를 짜는데 사용합니다.


Widget을 열고 변수 "AttachLocation"(Vector, 인스턴트 편집 가능을 True로 한다)을 만든 후, Button이 Press되었을 때의 BP를 짜냅니다.

위젯을 추가한 액터를 열고 다음과 같이 BP를 구성합니다.


이것으로 완성입니다.
Reference
이 문제에 관하여([UE4] VR에서 Widget에서 물건을 꺼내보세요), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/suihanki/items/5dc7b0e55e2249c51629텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)