[Solved] Trouble with retrieving FloorNormal data

Hi, I’m trying to retrieve the floorplane data detected by Nuitrack SDK.
I use Unity and Intel RealSense D415 for my project development.

I’m developing my own Unity project based on the “Creating your First Unity Project using Nuitrack SDK” tutorial, linked here.

And this link is what I’ve found from the Nuitrack Forum, with some googling involved:


And in the topic there was a link to a documentation of “UserFrame”:
http://download.3divi.com/Nuitrack/doc/classtdv_1_1nuitrack_1_1UserFrame.html

And I’ve found that there’s another documentation about the “UserFrame” class, under “.NET/C# Wrapper”:
http://download.3divi.com/Nuitrack/doc/classnuitrack_1_1UserFrame.html

I assumed that I should use the C# reference because I’m using Unity environment for my project.
This is what I did to my script:


public Vector3 normal;
private nuitrack.UserFrame UF = new nuitrack.UserFrame();

void Update()
{
if (cnt_update % 2 == 0) //camera was working in 30fps, while the update method was running in 60times/second
{
if (CurrentUserTracker.CurrentUser != 0) //if user is tracked
{

normal = UF.FloorNormal.ToVector3();
Debug.Log(normal);

And after running the project what I get is (0,0,0),
every time it prints the “normal vector” on the debugging console.

I’m a complete newbie on object-oriented languages…
Can anyone help me out? Thanks!

I’ve just found what the problem was… Thanks in advance!

Hello I met with the same problem as you, always(0,0,0), could you please tell me how to solve this problem?

Hi I’m sorry for the late reply. Are you still having the same problem?

1 Like

I have a similar problem
Could you tell me about your decision?

In NuitrackScripts(The Unity GameObject that contains necessary scripts, provided in Unity NuitrackSDK package), there is the script named CurrentUserTracker.cs. In this script I added some code to get floor data. You need to retrieve data whenever UserTracker is updated. That is why you should use events.

using UnityEngine;
using System.Collections;
...
public class CurrentUserTracker : MonoBehaviour
{
    ...
    static nuitrack.Vector3 currentFloorNormal; 
    public static nuitrack.Vector3 CurrentFloorNormal {get { return currentFloorNormal; } }

    static nuitrack.Vector3 currentFloor;
    public static nuitrack.Vector3 CurrentFloor { get { return currentFloor; } }
    ...

    void Start ()
    {
        DontDestroyOnLoad(this);
        NuitrackManager.onSkeletonTrackerUpdate += NuitrackManager_onSkeletonTrackerUpdate;
        NuitrackManager.onUserTrackerUpdate += NuitrackManager_onUserTrackerUpdate;
    }

    void NuitrackManager_onUserTrackerUpdate(nuitrack.UserFrame frame)
    {
        currentFloor = frame.Floor;
        currentFloorNormal = frame.FloorNormal;
    }
    ...
}
1 Like