Trouble with retrieving FloorNormal data

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

This is what I did to my script:


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

void Update()
{

if (CurrentUserTracker.CurrentUser != 0) //if user is tracked
{

normal = aaa.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.

Can anyone help me out? Thanks!

To get the floor plane, you can use the functions UserFrame::Floor() and UserFrame::FloorNormal(), but the floor should be well observed.

Thank you first. I have used the functions UserFrame.FloorNormal, however, I got (0,0,0), according to your advice, I try to make the camera observe floor well, but there is no change. I do not know why.
Maybe because the UserFrame() needs a parameter? I do not know what to pass to it. Sorry I am a beginner of C#.

We’ve noticed that you’re creating a new empty object UserFrame in your example:
private nuitrack.UserFrame aaa = new nuitrack.UserFrame ();
However, nuitrack.UserFrame must be received from UserTracker.OnUpdateEvent.
Are you updating it after UserTracker.OnUpdateEvent?

Okay thank you I will have a try!