none
Unity 5 + VisualGestureDataBase RRS feed

  • Question

  • Hi,

    I'm trying to add a specific Gesture to a VisualGestureBuilderFrameSource object after successfully creating a VisualGestureBuilderDataBase object from a gesture database file, i.e.

    public class Foo: MonoBehaviour {
    
        private KinectSensor _Sensor;
    
        void Start () {
            _Sensor = KinectSensor.GetDefault();
            if (_Sensor != null)
            {
                if (!_Sensor.IsOpen)
                {
                    _Sensor.Open();
                }
    
                VisualGestureBuilderFrameSource source = VisualGestureBuilderFrameSource.Create(_Sensor, 0);
                VisualGestureBuilderFrameReader reader = source.OpenReader();
                if (reader != null)
                {
                    reader.IsPaused = true;
                }
    
                string gestureFilePath = System.IO.Path.Combine(Application.streamingAssetsPath, "salute.gbd");
    
                using (VisualGestureBuilderDatabase gestureDataBase = VisualGestureBuilderDatabase.Create(gestureFilePath))
                {   
                    foreach (Gesture gesture in gestureDataBase.AvailableGestures)
                    {
                        // This is where the script crashes (gesture is null)
                        source.AddGesture(gesture);
                    }
                }
            }
        }
    }


    After creating the database object (gestureDataBase), the number of gestures appears to be correctly identified, however further inspection of the elements inside the AvailableGestures member shows all elements in the list are null.  The script crashes after calling source.AddGesture(gesture) => presumably because it's given an invalid pointer.  I've tried other gestureDataBase files and encountered the same issue.

    A similar issue was reported on another forum - when the developer changed the order in which the packages Kinect and Kinect.VisualGestureBuilder were imported, the problem was solved.  However, that solution doesn't appear to work in my case.

    Does anyone know if this is an issue particular to Unity 5 and VisualGestureBuilder not meshing well together?  I have yet to try Unity 4...

    Cheers,

    Friday, March 4, 2016 2:27 AM

All replies

  • Did you add the extra dlls for the GestureBuilder to work?

    In Visual Studio you have to add this command to the post compilation events:

    xcopy "$(KINECTSDK20_DIR)Redist\VGB\$(Platform)\vgbtechs" "$(TargetDir)\vgbtechs" /S /R /Y /I

    I have not worked with Unity, but I guess there is a similar option.


    • Edited by jmmroldan Friday, March 4, 2016 11:48 AM
    Friday, March 4, 2016 11:47 AM
  • Hello.

    I use Kinect with Unity4 and 5.

    I think you need confirm to have a valid ".gbd" file, to validate it in VGB.


    • Edited by nugao Monday, March 7, 2016 1:59 AM
    Monday, March 7, 2016 1:57 AM