U Can't Touch This - Nreal light용 MR 튜토리얼
10072 단어 tutorialunity3dmixedrealitycsharp

오른손 검지로 물체를 터치합니다.
샘플 리포지토리
샘플 실행
UCanTouchThis 로 변경합니다. 그리고 Unity로 엽니다. Build Setting , 플랫폼을 Android로 변경Project , Assets > import package > Custom Package를 선택하고 가져오기 NRSDKForUnityAndroid_1.7.0.unitypackage . Build Settings > Player Settings 확인Build 폼Build Settings 패널지도 시간
1. Nreal 개발을 위한 프로젝트 설정
Project , Assets > import package > Custom Package를 선택하고 가져오기 NRSDKForUnityAndroid_1.7.0.unitypackage . 2. NRInput에 대한 HandTracking 설정
NRInput를 선택하고 Input Source Type를 Hands로 변경합니다.NRHand_R > Assets > NRSDK > Prefabs > Hands > NRInput에서 Right를 넣습니다. NRHand_L > Assets > NRSDK > Prefabs > Hands > NRInput에서 Left를 넣습니다. 3. NRHandPointer_R 비활성화
NRHandPointer_R > NRInput > Right에서 NRHand_R를 선택합니다. NRHandPointer_R합니다. NRHandPointer_L ). 4. 빈 게임 개체 만들기
Pos X : 0, Pos Y : 0, Pos Z : 0 5. 알파 재질 만들기
Assets에서 재료 만들기 Rendering Mode 항목을 Fade 로 변경하십시오. 6. 손 추적을 위한 구 만들기
Sphere를 HandController에 넣으세요.Pos X : 0, Pos Y : 0, Pos Z : 0 ScaleX : 0.03 , Y : 0.03 , Z : 0.03 Ridgitbody .Use Gravity Materials에서 Assets로 설정합니다. 7. 핸드 트래킹 확장을 위한 C# 스크립트 생성
C# Script합니다. using NRKernal;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Hand Controller for Tip
/// </summary>
public class HandController : MonoBehaviour
{
/// <summary>
/// IndexTip GameObject
/// </summary>
public GameObject hand_R_IndexTip;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
// Get Right Hand
HandState handState = NRInput.Hands.GetHandState(HandEnum.RightHand);
// Get Index Tip Position of right hand
Vector3 handStateThumbTipPosition = handState.GetJointPose(HandJointID.IndexTip).position;
// Set Hand R IndexTip Sphere position
hand_R_IndexTip.transform.position = handStateThumbTipPosition;
}
}
8. "HandController"에 C# 스크립트를 첨부합니다.
hand_R_IndexTip 패널의 Inspector를 장면에서 "Hand_R_IndexTip"게임 개체로 설정합니다. 9. 대상 객체로 Cube 생성
Sphere를 Target에 넣으세요.Pos X : 0.1, Pos Y : -0.05, Pos Z : 0.8 ScaleX : 0.1 , Y : 0.1 , Z : 0.1 Ridgitbody .Use Gravity 10. 대상 게임 개체에 대한 C# 스크립트 만들기
C# Script합니다. using NRKernal;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
/// <summary>
/// Target Cube Script
/// </summary>
public class TargetCube: MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
/// <summary>
/// Display event log using console
/// </summary>
/// <param name="collision"></param>
void OnCollisionEnter(Collision collision)
{
Debug.Log("Hit!");
}
}
11. "Target"에 C# 스크립트를 첨부합니다.
12. 빌드
Build 폼Build Settings 패널Reference
이 문제에 관하여(U Can't Touch This - Nreal light용 MR 튜토리얼), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/kara_d_en/u-can-touch-this-mr-tutorial-for-nreal-light-4k8j텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)