Unity Kinect 2 Official plugin - BodyIndexFrameReference.AcquireFrame() always returns null. RRS feed

  • Question

  • Hi all, 

    first thanks a lot for making this official plugin for Unity, this rocks!

    I am working with UnityPro on Win8, and it works great

    But i got a little problem, when the event MultiSourceFrameArrived is dispatched, this method is called (since i added it as delegate): 

    void HandleMultiSourceFrameArrived (object sender, MultiSourceFrameArrivedEventArgs e)
    				MultiSourceFrame t_msf = e.FrameReference.AcquireFrame ();
    				ColorFrame t_cf = t_msf.ColorFrameReference.AcquireFrame ();
    				DepthFrame t_df = t_msf.DepthFrameReference.AcquireFrame ();
    				BodyIndexFrame t_bif = t_msf.BodyIndexFrameReference.AcquireFrame ();
    				if (t_cf != null && t_df != null && t_bif != null) {
    						Debug.Log ("READY TO KEY");
    				Debug.Log (t_cf + "," + t_df + "," + t_bif);
    				t_cf.Dispose ();
    				t_df.Dispose ();
    				t_bif.Dispose ();

    The problem is that t_bif is always null. What could cause this? Does my body has to be in front of the camera for it to work? Is this only valid when an actual body is in the frustum of the Kinect?

    I am trying to do keying live, from an example found online. I did check the GreenScreen example sure to make sure it worked...

    but it didn't work for me at first (plane is pink). I had to make sure to check the Use DX11 checkbox in the Unity player settings, then it started working (Plane is now green), which is logic since the shader is DX11

    Thanks again for any enlightement you can bring.


    Wednesday, December 3, 2014 8:01 PM


  • Ok, found it :)

    I had to pass the right type when opening multisource sensor 

    _Reader = _Sensor.OpenMultiSourceFrameReader (FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.BodyIndex);

    Hope it can help anyone


    Wednesday, December 3, 2014 8:12 PM