How can I use the Kinect V2 library with Godot?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By manfromtheinterwebs

Comment: I’d really appreciate any help I can get with this, even if it’s just a pointer in the right direction rather than the ultimate solution. I’ve run out of ideas and can’t find anything about using the kinect with godot online.

Godot Version: 3.2.1 Mono
OS: Windows 10

I followed this tutorial on using external libraries in Godot and did manage to get it to work with the Newtonsoft.Json package the guy used in the video. The tutorial tells you to just reference the .dll in the .csproj file like this:

<Reference Include="Newtonsoft.Json">
  <HintPath>$(ProjectDir)\lib\Newtonsoft.Json.dll</HintPath>
  <Private>False</Private>
</Reference>

I then tried the same thing with this package for the Kinect. I can have the line using Microsoft.Kinect; in my scripts without errors and autocomplete is working, but as soon as I actually mention anything from this sdk in the class, I get errors. What makes this confusing is that the error messages are different depending on where in the script I use the kinect library. Declaring a member variable (private KinectSensor sensor = null;) results in these errors:

If I use a line like KinectSensor sensor = KinectSensor.GetDefault(); in the ready method, I get this: E 0:00:00.612 debug_send_unhandled_exception_error: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Kinect, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. That’s a lot less cryptic but still doesn’t tell my why the file couldn’t be loaded.
I do have the kinect sdk installed and that’s working fine. I also read through the documentation on binding external libraries, but couldn’t figure out how to get a static library from the .dll file that I got from NuGet.

I get the same error.

Can you try using that Package in a normal, non Godot C# Project? Console Project for example?

juppi | 2020-06-19 18:56

Yes, the package works in a WPF app. I haven’t tested much of the functionality, but I can see the kinect turn on when I run my program.

manfromtheinterwebs | 2020-07-01 14:20