Unity
Unity_Oculus_VR
잉_민
2023. 6. 5. 12:36
728x90
반응형
setting
assetstore에서
oulus 받아서
이런저런 셋팅 설정해준다.
내가 하고싶은거는 우주선 조정하기.
일단 VR 카메라랑. 벌츄얼 손을 가져오고싶은데 (컨트롤러 안 쓰고)
이게 물체와 인터렉션 되면 좋겠다.
튜토리얼에 나온대로 .
oculusinteractionsamplerig를 가져오고
손에 handgrabinteractor 프리팹을 추가한다
오른손도 왼손도. 컴포넌트에 알맞은 손을 지정해주는것도 !
손은 일단 이렇게 끝난 것 같고,
조정할 물체가 잡을 수 있는 형식으로 컴포넌트를 추가해보자
튜토리얼에서는 이것저것 넣어줬다.
일단, 콜라이더 리지드바디.
리지드바디는 중력 뺴준다.
컴포넌트 난 두개만 추가했다.
grabbable, hand grab interactable
잡혀진다.
하지만 나는 우주선 조정 스틱이라 고정되어 있는 부분이 필요하다 . 어떻게 해야할지 찾아보자.
레버나 문은 힌지 사용
서랍 드래그하는거는 조인트사용
조이스틱은 이게 더 맞음
Configurable Jointsㅇ
이거 눌러야 빨간 동그라미 보임
joint랑 grabbable ,hand interactable이랑 충동하는거임.
해결 ??
joint가 자꾸 떨어짐.. 왜그럼..?
input
OvrPlayerController 프리팹을 Scene에 배치한다.
VR 조이스틱으로 이동 input thumbstick
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using OVR;
public class control : MonoBehaviour
{
float MovSpeed = 10f;
CharacterController cc;
void Start()
{
cc = GetComponent<CharacterController>();
}
void Update()
{
Vector2 mov2d = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
Vector3 mov = new Vector3(mov2d.x * Time.deltaTime * MovSpeed, 0f, mov2d.y * Time.deltaTime * MovSpeed);
cc.Move(mov);
}
// returns true if the primary thumbstick is currently pressed (clicked as a button)
OVRInput.Get(OVRInput.Button.PrimaryThumbstick);
// returns true if the primary thumbstick has been moved upwards more than halfway.
// (Up/Down/Left/Right - Interpret the thumbstick as a D-pad).
OVRInput.Get(OVRInput.Button.PrimaryThumbstickUp);
https://syaring92.tistory.com/2
using OVR;
float sm_forward = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick).y;
float sm_backward = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick).y;
float sm_leftward = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick).x;
float sm_rightward = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick).x;
float sm_upward = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick).y;
float sm_downward = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick).y;
728x90
반응형