问题描述
我正在尝试在Unity3D场景中使用Visual Gesture Builder中的.gbd文件.我已经将两个插件都导入了Unity(Kinect.2.0.1410.19000.unitypackage
和Kinect.VisualGestureBuilder.2.0.1410.19000.unitypackage
).随附的演示和框架数据可以正常工作.
I'm trying to use a .gbd file from Visual Gesture Builder in my Unity3D scene. I have imported both plugins to Unity( the Kinect.2.0.1410.19000.unitypackage
and Kinect.VisualGestureBuilder.2.0.1410.19000.unitypackage
). The included demos and skeleton data work fine.
在尝试导入这样的手势数据库时:
When tyring to import my gesture database like this:
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中是否有所不同?
What am I missing? Is the Kinect API any different in Unity?
推荐答案
我遇到了同样的问题.据我所知,您不能直接调用这些构造函数,而是需要调用静态方法Create.例如,在您的情况下,您会说...
I was running into the same problem. As far as I can tell, you cannot call these constructors directly, but you instead need to call on the static method Create. For example, in your case you would say...
_gestureDatabase = VisualGestureBuilderDatabase.Create(@"gestures.gbd");
_gestureFrameSource = VisualGestureBuilderFrameSource.Create(_Sensor,0);
这似乎可以解决问题,至少对我而言.稍后,我在尝试检索DiscreteGestureResult的代码中仍会遇到编译错误,但我将继续遍历源代码以寻找答案.
This seems to resolve the issue, at least for me. I'm still running into compilation errors later in the code where I try and retrieve the DiscreteGestureResult, but I'll keep going through the source code looking for answers.
这篇关于如何在Unity3D插件中使用Visual Gesture Builder数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!