본문 바로가기

강동새싹언리얼수업

231219 수업 VR GrabComponent 분석

https://vreue4.com/

 

VR Expansion Plugin – A Virtual Reality Tool Kit

The VR Expansion Plugin (VRE) was created to help facilitate advanced Virtual Reality interactions and gameplay elements in UE4/UE5. It is an MIT licensed and open source overhaul of many of the engines elements to better accommodate VR. It has been a long

vreue4.com

플러그인  다운로드

VRTemplate의 GrabComponent를 분석해보자

EVENT GRAPH

BeginPlay에서 SetShouldSimulateonDrop 실행후  Attach Parent를 받아와 PrimativeCompont로 캐스트 해준후 PhysicsActor로 CollisionProfile을 바꿔준다

SetShouldSimulateOnDrop 함수는 Parent에 simulatingPysics가 있다면 SimuateonDrop변수를 True로 해준다

GrabComponent는 다음과 같은 함수와 변수 이벤트디스패처등을 갖고 있다.

 

TryGrab이라는 함수의 앞 Sequece는 순차적으로 Then N을 실행해준다 GrabType변수에 따라 다른 처리를 해준다

GrabType이 free일 경우 Physics를 끄고 Motion Controller에 붙인다. isHeld변수를 true로 해 준다.

Type이 socket일 경우 다음 처리를 더해준다. 회전을 반대로 해주고

위치도 부착된 부모의 위치를 Motion Controller로 위치로 옮겨주는데 

 

모션 컨트롤러와 상호 작용하는 구조

BP_GrabItem을 Actor로 만들어

StaticMesh와 GrabComponent를 넣어준다.

Motion컨트롤러에 붙었는지 체크

그랩후 물건이 있으면 true가 된다.

Actor로 BP_GrabItem을 만들고 메시와 GrabComponent를 추가한다.

불리언이 숫자로 표시됨

 

MappingContext추가

불필요한 기존 내용 연결제거

이동및 회전추가