# Nreal Support

## Nreal Unity SDK Download

In order to support Nreal Glasses, **Nreal Unity SDK** is required. click [here](https://developer.nreal.ai/download) to download the SDK. Download Nreal Unity SDK and click **Assets/import Package** to add onto your project.

## MAXST VPS Unity SDK for Nreal Glasses Download

In order to support Nreal Glasses, **MAXSTVPS Unity SDK** for Nreal Glasses is required. Click [here](https://github.com/maxstdev/VPSSDKUnity_NReal) to download the SDK. Click **Assets/import Package** to add the SDK onto your project.

## Unity Scene Components

Unity Scene components for Nreal Glasses are as follows. Detailed information regarding Unity Scene components can be found in the link below. **ARCamera** from the former Unity Scene is replaced with **NRCameraRig**.&#x20;

{% content-ref url="../unity-scene/unity-scene" %}
[unity-scene](https://maxstvps.gitbook.io/documentation-eng/-MbEQLJaN0vXKGxXQmJX/unity-scene/unity-scene)
{% endcontent-ref %}

![ Unity Scene Hierarchy for Nreal Glasses](https://3673497343-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Mb9PH5wRNtA8vy7FYv1%2F-MbC9hBiUz3Q23AJOqRQ%2F-MbCBBDLFTCKyZ2VOBTd%2Fimage.png?alt=media\&token=cc624dac-cde3-484e-9847-3751c40f373a)

\
SceneManager Components <a href="#scenemanager" id="scenemanager"></a>
----------------------------------------------------------------------

ARCamera from SceneManager is replaced with **NRCameraRig Object**

![SceneManager Components for Nreal](https://3673497343-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Mb9PH5wRNtA8vy7FYv1%2F-MbC9hBiUz3Q23AJOqRQ%2F-MbCBuE-xvNl5FS0tVcX%2Fimage.png?alt=media\&token=d8024513-8c1e-465b-b599-ce2188b4f1de)

## Nreal Camera Start/ VPS Tracker Start <a href="#nreal-vps" id="nreal-vps"></a>

‌Play() of Instance from NRCollect YUV starts Nreal Camera.

VPSTracker Start can be found in the page below.

{% content-ref url="../scene-manager-1/scene-manager" %}
[scene-manager](https://maxstvps.gitbook.io/documentation-eng/-MbEQLJaN0vXKGxXQmJX/scene-manager-1/scene-manager)
{% endcontent-ref %}

{% code title="NRealSceneManager.cs" %}

```csharp
nRCollectYUV = new NRCollectYUV();
nRCollectYUV.Play();
TrackerManager.GetInstance().StartTracker();

if (serverName != "")
{
    string vpsquery = "{\"vps_server\":\"" + serverName + "\"}";
    TrackerManager.GetInstance().AddTrackerData(vpsquery);
}
```

{% endcode %}

## Get result for VPS Tracker &#x20;

This is a code for ARFrame Instance from Unity Update(). This is a code to obtain the posture of 6Degrees of Freedom on VPS Map at the time of update and reflect it on the virtual camera for rendering.&#x20;

{% code title="NRealSceneManager.cs" %}

```csharp
void Update()
{
    TrackerManager.GetInstance().UpdateFrame();
    nRCollectYUV.UpdateFrame();
    var eyePoseFromHead = NRFrame.EyePoseFromHead;
    Matrix4x4 Mhe = MatrixUtils.ConvertPoseToMatrix4x4(eyePoseFromHead.RGBEyePos);

    ARFrame arFrame = TrackerManager.GetInstance().GetARFrame();

    if (arFrame.GetARLocationRecognizeState() == ARLocationRecognizeState.ARLocationRecognizeStateNormal)
    {
        Matrix4x4 targetPose = arFrame.GetTransform(Mhe);

        arCamera.transform.position = MatrixUtils.PositionFromMatrix(targetPose);
        arCamera.transform.rotation = MatrixUtils.QuaternionFromMatrix(targetPose);
        arCamera.transform.localScale = MatrixUtils.ScaleFromMatrix(targetPose);

        rootTrackable.SetActive(true);
    }
    else
    {
        rootTrackable.SetActive(false);
    }
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://maxstvps.gitbook.io/documentation-eng/-MbEQLJaN0vXKGxXQmJX/nreal/nreal.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
