Grabbable (Two Grab Transformers)

VR/Oculus Integration 2023. 12. 19. 11:21
반응형

 

https://developer.oculus.com/documentation/unity/unity-isdk-grabbable/

 
https://youtube.com/playlist?list=PLTFRwWXfOIYB9hru6EjeVS0E-4jNiOuQQ&si=zoJ3NoYX6YrGnpg1

Unity VR with Oculus Integration 57.0

Unity VR with Oculus Integration

www.youtube.com



 
Grabbable 구성 요소의 Two Grab Transformer 속성에 Two Grab Transformer 구성 요소를 할당해야 합니다.
Two Grab Transformer 구성 요소를 추가하는 경우 One Grab Transformer 속성도 더 이상 자동 생성되지 않으므로 설정해야 합니다.
 
 
 
잡기 기본형을 만들고 다음 3가지 Transformer를 테스트 합니다 
 
기본 잡기가 완성 되었습니다.
 

 
 
 
물리 던지기 까지 설정 해주자 
 

 

 

TwoGrabFreeTransformer

포인팅 가능한 두 대상의 위치 및 회전 변경을 고려하여 Grabbable의 위치, 회전 및 크기를 업데이트합니다(크기에 대한 선택적 제약 조건 포함).
 
먼저 양속 잡기를 설정 하기 위해서는 다음 두개의 프로퍼티에 각각 넣어줘야 한다 

 
 
 
다음과 같이 One Grab Free Transformer컴포넌트와 Two Grab Free Transformer컴포넌트를 부착 하고  

 
 
넣어준다 

 
 
실행후 결과를 확인 한다 

 
 
 
크기를 제약 하고 싶다면 Min Scale과 Max Scale값을 수정하면 된다 

true인 경우 제약 조건은 객체의 초기 크기를 기준으로 합니다. false인 경우 제약 조건은 개체의 x축 배율에 대해 절대적입니다.

 

 


 

TwoGrabRotateTransformer

피벗에 대한 두 개의 포인팅 가능한 대상의 회전 변경을 고려하여 Grabbable의 회전을 업데이트합니다(최소/최대 회전에 대한 선택적 제약 조건 포함).
 
Two Grab Free Transformer 컴포넌트를 제거 하고 Two Grab Rotate Transformer컴포넌트를 부착 한다 

 
Grabbable의 Two Grab Transformer 프로퍼티에 넣어주자 

 
 
Two Grab Rotate Transformer의 Rotation Axis 프로퍼티를 변경해 축을 바꿀수도 있고 Min/Max Angle을 이용해 각을 조절 할수도 있다
 
 

 
 


TwoGrabPlaneTransformer

주어진 평면에 대한 Grabbable의 위치와 배율뿐만 아니라 주어진 축에 대한 회전도 업데이트합니다(위치와 배율에 대한 선택적 제약 조건 포함).
 
이번에는 Two Grab Plane Transformer를 부착 해보고 테스트 해보자 

 
 
위치와 배율
주어진 축에 대한 회전 
에 대한 인터렉션이 되는지 확인 해야 한다 
 
 

 
 
코드를 까보면 다음과 같이 Y 위치를 제약 한다 

 Vector3 targetPosition = _capturePosition;
            // Y axis constraints
            if(_constraints.MinY.Constrain)
            {
                targetPosition.y = Mathf.Max(_constraints.MinY.Value, targetPosition.y);
            }
            if(_constraints.MaxY.Constrain)
            {
                targetPosition.y = Mathf.Min(_constraints.MaxY.Value, targetPosition.y);
            }
            targetTransform.position = targetPosition;

 
 

양손 그랩 Y축 제약

 
 
옵션의 plane transform은 회전의 up 방향이다 

 

 

 

 


 
 
 
참고 
https://developer.oculus.com/documentation/unity/unity-isdk-grabbable/ovrsource-legacy/Doc/mdsourcedc/documentation/unity/unity-isdk-create-hand-grab-interactions/
https://developer.oculus.com/documentation/unity/unity-isdk-grabbable/
 
리소스 링크 
https://skfb.ly/oF7Nu

반응형

'VR > Oculus Integration' 카테고리의 다른 글

활시위 당기는 법  (0) 2023.12.22
OneGrabPhysicsJointTransformer  (0) 2023.12.20
Grabbable  (0) 2023.12.18
FingerFeatureStateThresholds  (0) 2023.12.14
Unity VR Build a Custom Hand Pose (Oculus Integration SDK)  (0) 2023.12.14
: