'전체 글'에 해당되는 글 1809건

  1. 2023.12.27 Access hand data from Unity components in the scene
  2. 2023.12.27 XR Interaction Toolkit 2.4.3 OpenXR Throw Object
  3. 2023.12.26 XR Interaction Toolkit 2.4.3 (OpenXR) Animated Hand Model
  4. 2023.12.26 [OpenXR] XR Interaction Toolkit 2.4.3 컨트롤러와 핸드트래킹
  5. 2023.12.26 At least one interaction profile must be added. Please select which controllers you will be testing against in the Feature menu.
  6. 2023.12.26 XRI 샘플 프로젝트 열어보기 (Starter Assets)

Access hand data from Unity components in the scene

VR/XR Interaction Toolkit 2023. 12. 27. 11:03
반응형

https://docs.unity3d.com/Packages/com.unity.xr.hands@1.3/manual/hand-data/xr-hand-access-data.html

Access hand data from Unity components in the scene | XR Hands | 1.3.0

Access hand data from Unity components in the scene Access hand-tracking data from Unity components in the scene. The XRHandTrackingEvents component can be added to a GameObject in the scene to subscribe to hand-tracking events for a particular hand chosen

docs.unity3d.com

반응형
:

XR Interaction Toolkit 2.4.3 OpenXR Throw Object

VR/XR Interaction Toolkit 2023. 12. 27. 10:13
반응형

https://youtube.com/playlist?list=PLTFRwWXfOIYBIPKhWi-ZO_ITXqtNuqj6j&si=9t2YSxJcsw7fRNMR

XR Interaction Toolkit 2.4.3

XR Interaction Toolkit 2.4.3 OpenXR Oculus

www.youtube.com


새 씬을 만들고 

메인 카메라를 지우고 XR Origin을 추가 한다 

 
XR Origin 오브젝트를 선택한뒤 Tracking Origin Mode를 Floor 로 변경한다 

Left/Right Controller를 선택한뒤 
 

 
XR Controller를 제외한 나머지 컴포넌트를 제거 한다 

 
실행한뒤 컨트롤러가 잘 나오는지 확인 하자 
 

 
 
빈오브젝트 (Cube)를 만들고 자식으로 빈오브젝트 (Visuals)를 만들고 그 자식으로 큐브를 만들어 준다 

Mesh는 큐브다 

 
Cube 오브젝트를 선택하고 Rigidbody와 XR Grab Interactable 컴포넌트를 부착 하고 
Use Gravity는 체크 해제 한뒤 Interaction Manager에 XR Interaction Manager게임오브젝트를 넣어준다 

 
Left Controller를 선택하고 XR Direct Interactor 컴포넌트를 붙여 준다 

 
Interaction Manager에 XR Interaction Manager오브젝트를 넣어주자 

 
이어서 Sphere Collider를 부착 하고 Is Trigger를 체크 하고 Radius를 0.1로 설정 한다 

 
Cube 오브젝트를 선택하고 위치를 적당히 보이게 설정한다 

실행후 잡히는지 테스트 해본다 
 

 
이렇게 잡고 놨을때 날라가버리면 
Cube오브젝트를 선택하고 Is Kinematic 을 체크 한다 

다시 실행해보자 
 

 
이렇게 왼손 잡기가 잘 되면 오른손도 똑같이 해주자 

 
플레이를 해보고 왼손 오른손 잡기가 모두 동작 하는지 확인 한다 
 

 


 

Throw an Object 

 
Cube 오브젝트를 선택하고 Use Gravity를 체크 하고 Is Kinematic을 체크 해제 한다 

 
Cube를 하나 만들어 Desk를 만들어 주고 

 
 

 


 

애니메이션 손을 적용하기 

 
Left Controller 자식으로 빈 오브젝트 Hand Visual을 만들고 
그 자식으로 Offset 빈 오브젝트를 생성한다 

 
 

 
오른쪽도 동일하게 진행하고 플레이후 테스트 한다 
 
손의 위치와 회전이 맞지 않는다면 런타임에서 마추고 Transform컴포넌트를 복사해 적용한다 

왼손 Offset

 
 

오른손 Offset

 
실행후 테스트 해본다 
잘 동작한다 

 
 
 


 
스카이박스 

Skybox_Gradient.unitypackage
0.00MB

 
 
 
오큘러스 핸드 

OculusHand_L_R.unitypackage
0.43MB

 
 
 
오큘러스 핸드 메터리얼 

OculusHand_Mat.unitypackage
0.53MB

 
 
 
오큘러스 Animated Hands

Oculus_Animated_Hands.unitypackage
0.99MB

 
 
 
URP 프로토타입 메터리얼 
https://assetstore.unity.com/packages/2d/textures-materials/minimalist-scalable-grid-prototype-materials-214264

Minimalist Scalable Grid Prototype Materials | 2D 텍스처 및 소재 | Unity Asset Store

Elevate your workflow with the Minimalist Scalable Grid Prototype Materials asset from MLAgent. Find this & more 텍스처 및 소재 on the Unity Asset Store.

assetstore.unity.com

 

반응형
:

XR Interaction Toolkit 2.4.3 (OpenXR) Animated Hand Model

VR/XR Interaction Toolkit 2023. 12. 26. 16:07
반응형

 https://youtube.com/playlist?list=PLTFRwWXfOIYBIPKhWi-ZO_ITXqtNuqj6j&si=9t2YSxJcsw7fRNMR


새 씬을 만들고 메인 카메라를 제거 한다 

 
오큘러스 핸드 모델을 넣어주고 

OculusHand_L_R.unitypackage
0.43MB

 
 
 

물론 XRHands에 있는걸 써도 된다 

 
 
 
XR Origin을 만들어 준다 

 
 
Origin Mode를 설정 하고 

 
 
Left Controller를 선택해 매니저를 넣어주자 

 
오른쪽도 똑같이 해준다 

 
 
Left Controller를 선택하고 자식으로 빈 오브젝트(Hand Visual)를 만든다 

 
그 자식으로 빈오브젝트(Offset)을 또 만들어 주고 

 
Left Controller 오브젝트를 선택하고 XR Controller 컴포넌트의 Model 프로퍼티의 Model Prefab에는 왼손 모델을 
Model Parent에는 Offset 오브젝트를 넣어준다  

 
오른손도 똑같이 한다 

 
 
Skybox를 간지나게 하고 싶다면 다음패키지를 설치 하고 

skybox_gradient.unitypackage
0.00MB
스카이 박스 메터리얼을 변경해준다


 
 
이제 플레이를 해보고 결과를 확인 하자 
 

 
손은 잘 나오는데 회전을 좀 해야 할거 같다 
다음과 같이 Offset오브젝트의 Rotation X , Y 를 90으로 설정 한다 

 
오른손은 다음과 같이 설정한다 

 
 
다시 실행후 결과를 확인 하자 
 

위치도 조금 내려주자 

왼손
오른손

 
다시 실행해보고 확인해보자 

 
 
이제 왼손모델을 가져와서 언팩하고 프리팹으로 만들어 준다 

오른손도 똑같이 해준다 

Left / Right Controller의 모델 프리팹을 다시 연결해주자 

 
 
 
 
애니메이션을 만들어 주고 

 
블랜드 트리를 생성하고 

 
테스트 
 

 
 
스크립트를 하나 만들고 

 

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;

public class Hand : MonoBehaviour
{
    public InputDeviceCharacteristics inputDeviceCharacteristics;

    private InputDevice _targetDevice;
    [SerializeField] private Animator _handAnimator;

    private void Start()
    {
        InitializeHand();
    }

    private void InitializeHand()
    {
        List<InputDevice> devices = new List<InputDevice>();
        InputDevices.GetDevicesWithCharacteristics(inputDeviceCharacteristics, devices);

        if (devices.Count > 0)
        {
            _targetDevice = devices[0];
        }
    }

    private void Update()
    {
        if (!_targetDevice.isValid)
        {
            InitializeHand();
        }
        else
        {
            UpdateHand();
        }
    }

    private void UpdateHand()
    {
        SetAnimatorParameterValue(CommonUsages.grip, "Grip");
    }

    private void SetAnimatorParameterValue(InputFeatureUsage<float> feature, string parameterName)
    {
        if (_targetDevice.TryGetFeatureValue(feature, out float value))
        {
            _handAnimator.SetFloat(parameterName, value);
        }
        else
        {
            _handAnimator.SetFloat(parameterName, 0);
        }
    }
}

 
오른손도 똑같이 해준다 

 
 

 
 
 
 


OculusHand_Mat.unitypackage
0.53MB

 
 
참고 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//This will allow us to get InputDevice
using UnityEngine.XR;

public class InputReader : MonoBehaviour
{
//Creating a List of Input Devices to store our Input Devices in
    List<InputDevice> inputDevices = new List<InputDevice>();

// Start is called before the first frame update
    void Start()
    {
//We will try to Initialize the InputReader here, but all components may not be loaded
        InitializeInputReader();
    }

//This will try to initialize the InputReader by getting all the devices and printing them to the debugger.
    void InitializeInputReader()
    {
        InputDevices.GetDevices(inputDevices);

        foreach (var inputDevice in inputDevices)
        {
            Debug.Log(inputDevice.name + " " + inputDevice.characteristics);
        }
    }

// Update is called once per frame
    void Update()
    {
//We should have a total of 3 Input Devices. If it’s less, then we try to initialize them again.
        if (inputDevices.Count < 2)
        {
            InitializeInputReader();
        }
    }
}

https://fistfullofshrimp.com/unity-vr-inputs-and-hand-animation/
 
 

반응형
:

[OpenXR] XR Interaction Toolkit 2.4.3 컨트롤러와 핸드트래킹

VR/XR Interaction Toolkit 2023. 12. 26. 13:02
반응형

 
https://youtube.com/playlist?list=PLTFRwWXfOIYBIPKhWi-ZO_ITXqtNuqj6j&si=9t2YSxJcsw7fRNMR

XR Interaction Toolkit 2.4.3

XR Interaction Toolkit 2.4.3 OpenXR Oculus

www.youtube.com


프로젝트 셋팅을 열고 Provider를 OpenXR로 선택하고 

 
다음과 같이 셋팅하고 

 
다음과 같이 액션 추가 해주고 

 
프리셋 매니저를 열고 Left, Right 적어주고 

 
씬을 하나 만들고 

 
메인카메라를 지우고 

 
 
XR Origin 만들어 주고 

 
 
Floor 설정 하고 

 
 
Left Controller 선택해서 매니저 넣어주고 오른쪽도 똑같이 해주고 

 
 
실행해서 컨트롤러 잡고 잘 나오나 잘 움직이나 확인 하고 
 

 
Camera Offset자식으로 빈오브젝트 HandVisualizer 만들고 
 

 
다음 컴포넌트를 부착한다 

 
left hand 검색해서 Left Hand Tracking 프리팹을 가져오고 오른쪽도 해준다 

 
HandVisualizer 오브젝트 선택하고 프로퍼티에 각각 알맞게 넣어줌 

 
 

 
실행해본다 
자동으로 컨트롤러가 꺼지지 않는 이유는?
 

 
 
샘플은 아주 잘되죵
 

 
 
 
 


 
이건가?

 

 
맞네유

 

 

반응형
:

At least one interaction profile must be added. Please select which controllers you will be testing against in the Feature menu.

VR/XR Interaction Toolkit 2023. 12. 26. 12:28
반응형

https://docs.unity3d.com/Packages/com.unity.xr.openxr@1.8/manual/features/oculustouchcontrollerprofile.html

 

Oculus Touch Controller Profile | OpenXR Plugin | 1.8.2

Oculus Touch Controller Profile Enables the OpenXR interaction profile for Oculus Touch controllers and exposes the device layout within the Unity Input System. For more information about the Oculus Touch interaction profile, see the OpenXR Specification.

docs.unity3d.com

 

 

반응형
:

XRI 샘플 프로젝트 열어보기 (Starter Assets)

VR/XR Interaction Toolkit 2023. 12. 26. 12:27
반응형

 

실행하면 핸드도 안나오고 컨트롤러도 안나옴 

 

모징

 

 

새 씬을 만들어 테스트 해본다 

 

 

 

 

왜 핸드 트래킹으로 인식 하는거지 

컨트롤러 잡으면 안움직이고 

 

 

https://smilejsu.tistory.com/3288

 

At least one interaction profile must be added. Please select which controllers you will be testing against in the Feature menu.

https://docs.unity3d.com/Packages/com.unity.xr.openxr@1.8/manual/features/oculustouchcontrollerprofile.html Oculus Touch Controller Profile | OpenXR Plugin | 1.8.2 Oculus Touch Controller Profile Enables the OpenXR interaction profile for Oculus Touch cont

smilejsu.tistory.com

 

다시 스타터 씬으로 돌아와서 테스트 

 

 

 

잘되는거 같긴 한데 핸드일때 손이 안나오고 컨트롤러가 나옴 

 

 

HandVisualizer씬의 이게 있어야 할거 같은디 

 

 

 

 

 

다시 스타터로 돌아와서 

 

컴포넌트를 부착 하고 

 

 

 

 

 

와우 이게 머선일이지

 

 

 

반응형
: