티스토리 뷰

Unity

Unity_Oculus_VR

잉_민 2023. 6. 5. 12:36
728x90
반응형

https://youtu.be/WELSs-lPJYA

 

setting

assetstore에서 

oulus 받아서 

이런저런 셋팅 설정해준다.

 

내가 하고싶은거는 우주선 조정하기.

일단 VR 카메라랑. 벌츄얼 손을 가져오고싶은데 (컨트롤러 안 쓰고)

이게 물체와 인터렉션 되면 좋겠다.

 

튜토리얼에 나온대로 .

oculusinteractionsamplerig를 가져오고

손에 handgrabinteractor 프리팹을 추가한다

오른손도 왼손도. 컴포넌트에 알맞은 손을 지정해주는것도 !

손은 일단 이렇게 끝난 것 같고,

 

 

조정할 물체가 잡을 수 있는 형식으로 컴포넌트를 추가해보자

튜토리얼에서는 이것저것 넣어줬다.

일단, 콜라이더 리지드바디. 

리지드바디는 중력 뺴준다.

컴포넌트 난 두개만 추가했다.

grabbable, hand grab interactable

잡혀진다.

 

 

하지만 나는 우주선 조정 스틱이라 고정되어 있는 부분이 필요하다 . 어떻게 해야할지 찾아보자.

 

레버나 문은 힌지 사용

https://youtu.be/bYS35_hC6B0

서랍 드래그하는거는 조인트사용

 

조이스틱은 이게 더 맞음

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
반응형

'Unity' 카테고리의 다른 글

Unity_ Vector 3 _ CSV file  (0) 2023.06.10
unity _ VR _oculus _ thumbstick _ joystick 회전  (0) 2023.06.07
Unity_ postprocessing &fog  (0) 2023.01.16
VR_unity _ setting _ oculus quest2  (0) 2023.01.16
Unity_ animation _trigger  (0) 2022.12.14
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함
반응형