我正在尝试在Unity3D场景中使用Visual Gesture Builder中的.gbd文件。我已将两个插件导入Unity(Kinect.2.0.1410.19000.unitypackage
和Kinect.VisualGestureBuilder.2.0.1410.19000.unitypackage
)。包含的演示和骨架数据工作正常。
当tyring导入我的手势数据库时,如下所示:
using Windows.Kinect;
using Microsoft.Kinect.VisualGestureBuilder;
void Start ()
{
_Sensor = KinectSensor.GetDefault();
// compilation error for the following line, see below
_gestureDatabase = new VisualGestureBuilderDatabase(@"gestures.gbd");
// check if sensor is there....
_gestureFrameSource = new VisualGestureBuilderFrameSource(_Sensor, 0);
_gestureFrameSource.AddGestures(_gestureDatabase.AvailableGestures);
}
编译失败:
Microsoft.Kinect.VisualGestureBuilder.VisualGestureBuilderDatabase.VisualGestureBuilderDatabase(System.IntPtr)' is inaccessible due to its protection level'
和
The best overloaded method match for `Microsoft.Kinect.VisualGestureBuilder.VisualGestureBuilderDatabase.VisualGestureBuilderDatabase(System.IntPtr)' has some invalid arguments
我错过了什么? Kinect API在Unity中有什么不同吗?
答案 0 :(得分:1)
我遇到了同样的问题。据我所知,你不能直接调用这些构造函数,但你需要调用静态方法Create。例如,在你的情况下你会说......
_gestureDatabase = VisualGestureBuilderDatabase.Create(@"gestures.gbd");
_gestureFrameSource = VisualGestureBuilderFrameSource.Create(_Sensor,0);
这似乎解决了这个问题,至少对我而言。我仍然在代码中遇到编译错误,我尝试并检索DiscreteGestureResult,但我将继续浏览源代码以寻找答案。