이런식으로 Grabbable에 옵션으로 한손과 두손관련 정보를 담은 스크립트를 할당해주면
크기를 늘릴 수 있다.
미완성
위의 코드는 오른손과 왼손은의 인지를 다르게 해주게 하기 위함이다.
예를들어 왼손으로는 오른손아래 손잡이를 잡지 못하게 할 수 있다.
using Oculus.Interaction;
using Oculus.Interaction.HandGrab;
using UnityEngine;
using static OVRHand;
public class HandController : MonoBehaviour
{
[SerializeField]
private Hand HandType = Hand.None;
public HandGrabInteractor leftHandGrabInteractor;
public HandGrabInteractor rightHandGrabInteractor;
private void OnTriggerEnter(Collider other)
{
if (HandType == Hand.HandLeft
&& other.GetComponent<OneGrabFreeTransformer>() != null) {
leftHandGrabInteractor.gameObject.SetActive(false);
}
else if (HandType == Hand.HandRight
&& other.GetComponent<TwoGrabFreeTransformer>() != null)
{
rightHandGrabInteractor.gameObject.SetActive(false);
}
}
private void OnTriggerExit(Collider other)
{
if (HandType == Hand.HandLeft
&& other.GetComponent<OneGrabFreeTransformer>() != null)
{
leftHandGrabInteractor.gameObject.SetActive(true);
}
else if (HandType == Hand.HandRight
&& other.GetComponent<TwoGrabFreeTransformer>() != null)
{
rightHandGrabInteractor.gameObject.SetActive(true);
}
}
}
완성이되면 왼손 오른손 각각 이미지를 로드 후 세이브 해서 손모양을 저장하고
손을 가져다 대면 각각 왼손과 오른손이 지정된 위치로 그랩을 할 수 있다.
'산대특 > VRAR' 카테고리의 다른 글
[VR] Locomotion(Teleport) (0) | 2024.04.23 |
---|---|
[VR]반대손 복사와 회전 및 던지기 (0) | 2024.04.19 |
[VR]총 잡기 - HandGun Grab (1) | 2024.04.18 |
Create Ghost Reticles (0) | 2024.04.18 |
Oculus Settings and Grab (0) | 2024.04.17 |