This content originally appeared on DEV Community and was authored by Kazuhiro Hara™
Sample Repository
Run the sample
- Clone Sample Repository, Change current directory to
HandTracking
. And Open with Unity. - Download NRSDK 1.7.0 from https://nreal-public.nreal.ai/download/NRSDKForUnityAndroid_1.7.0.unitypackage
- Open
Build Setting
, change Platform toAndroid
- Open
Project
, selectAssets
>import package
>Custom Package
and importNRSDKForUnityAndroid_1.7.0.unitypackage
. - Check
Build Settings
>Player Settings
by referring to Configure Build Settings - Press
Build
formBuild Settings
panel - Install *.apk on Android or DevKit.
Tutorial
1. Setting up the project for Nreal development
- See Quickstart for Android - NRSDK Documentation and configure the build settings.
- Download NRSDK 1.7.0 from https://nreal-public.nreal.ai/download/NRSDKForUnityAndroid_1.7.0.unitypackage
- Open
Project
, selectAssets
>import package
>Custom Package
and importNRSDKForUnityAndroid_1.7.0.unitypackage
.
2. Create Material
- Open
Project
, selectAssets
- Create
Material
onAssets
- Change name to “TouchCubeMaterial”
- Change
Albedo
to “CC0000”
3. Put Cube in the Scene
- Put
Cube
in the Scene- Change name to “TouchCube”
-
Pos X
: 0,Pos Y
: 0,Pos Z
: 8
4. Put a Canvas in the scene
- Put
Canvas
fromCreate
>UI
- Set property on
Inspector
panel-
Render Mode
: World Space -
Pos X
: 0 ,Pos Y
: -0.35Pos Z
: 3 -
Scale
-
X
: 0.005 ,Y
: 0.005 ,Z
: 0.005
-
-
5. Put Text in Canvas
- Put
Text
as a child ofCanvas
with the name "Counter”.-
Pos X
: 0,Pos Y
: -30,Pos Z
: 3 - Change
Text
to “0” - Change
Color
to “FFCC00” - Change Font size to 30
-
6. Create C# Script in Assets
- Create
C# Script
in the asset with the file name "HandTrack.cs". - Write the code as follows
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class HandTrack : MonoBehaviour, IPointerClickHandler
{
/// <summary>
/// Counter Text GameObject
/// </summary>
public Text targetText;
/// <summary>
/// Counter value
/// </summary>
private int counter = 0;
/// <summary>
/// HandTracking Click Handler
/// </summary>
/// <param name="eventData"></param>
public void OnPointerClick(PointerEventData eventData)
{
counter++;
targetText.text = counter.ToString();
//throw new System.NotImplementedException();
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
7. Attach the C# script on “TouchCube”
- Attach "HandTrack.cs" to “TouchCube”
- Set
Target Text
onInspector
panel toCounter
on the scene.
- Set
8. Build
- Press
Build
formBuild Settings
panel - Install *.apk on Android or DevKit.
This content originally appeared on DEV Community and was authored by Kazuhiro Hara™
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.

APA
MLA
Kazuhiro Hara™ | Sciencx (2022-02-14T07:48:12+00:00) HandTracking – MR Tutorial for Nreal light. Retrieved from https://www.scien.cx/2022/02/14/handtracking-mr-tutorial-for-nreal-light/
" » HandTracking – MR Tutorial for Nreal light." Kazuhiro Hara™ | Sciencx - Monday February 14, 2022, https://www.scien.cx/2022/02/14/handtracking-mr-tutorial-for-nreal-light/
HARVARDKazuhiro Hara™ | Sciencx Monday February 14, 2022 » HandTracking – MR Tutorial for Nreal light., viewed ,<https://www.scien.cx/2022/02/14/handtracking-mr-tutorial-for-nreal-light/>
VANCOUVERKazuhiro Hara™ | Sciencx - » HandTracking – MR Tutorial for Nreal light. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/14/handtracking-mr-tutorial-for-nreal-light/
CHICAGO" » HandTracking – MR Tutorial for Nreal light." Kazuhiro Hara™ | Sciencx - Accessed . https://www.scien.cx/2022/02/14/handtracking-mr-tutorial-for-nreal-light/
IEEE" » HandTracking – MR Tutorial for Nreal light." Kazuhiro Hara™ | Sciencx [Online]. Available: https://www.scien.cx/2022/02/14/handtracking-mr-tutorial-for-nreal-light/. [Accessed: ]
rf:citation » HandTracking – MR Tutorial for Nreal light | Kazuhiro Hara™ | Sciencx | https://www.scien.cx/2022/02/14/handtracking-mr-tutorial-for-nreal-light/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.