Wednesday, January 25, 2012

How to Setup Zigfu and Unity3D Tutorial

Introduction:

This is a step by step tutorial on how to setup Zigfu with Unity Engine for both window and mac users.

Zigfu is a set of libraries and scripts to provide a platform for apps and games using the Microsoft Kinect. Zigfu was originally developed by Amir Hirsch, Ted Blackman, Roee Shenberg, Shlomo Zippel.

Zigfu provides following SDKs:

1- Open NI,
2- Sensor Kinect
3- Primesense's NITE

You can find some articles on how each of these libraries work by googling them.Make sure to look at the documentation that comes with these libraries to find out how they actually work. They also provide you with the sample codes so you can get some ideas how things run.

Alright, let's get started:

WINDOWS 7

Step 1:

Following requirements are needed for this tutorial:

1- Microsoft's Kinect Device
2- Unity3D Engine(http://unity3d.com/)
3- Zigfu (http://zigfu.com/devtools.html)

Note: Do not install Microsoft Kinect SDK. The SensorKinect driver that comes with Zigfu conflicts with KinectSDK. You can find more information regarding this here (http://zigfu.com/news/?m=201108)

Check out the following link for pros and cons between Microsoft Kinect SDK and the PrimeSense OpenNI SDK:

http://www.brekel.com/?page_id=671

Uninstall Microsoft Kinect SDK in case you have it installed before.Connect your Kinect device to your machine and follow step 2.

Step 2:

Download both DevBundle for window and Unity3d Bindings from Zigfu website.

Step 3:

Run
ZigFuDevBundle_v2.0b.exe. After installation is over, you should have two folders OpenNI, PrimeSense in your installation folder.










Step 4:

Now you need to install the SensorKinect driver. Simply go to driver's folders and run dpinst depending on your Windows 7 version. In my case, I am using windows 7 64 bits so I chose dpinst-amd64.exe 

\PrimeSense\SensorKinect\Driver\dpinst-amd64.exe 

Step 5:

Your Kinect device is now recognized by window.Just check the device manager to make sure your device is installed properly.
simply type devmgmt.msc in Start->SearchBox


Try to check out some of the samples that come with these SDKs. For instance, go to 
C:\Program Files (x86)\OpenNI\Samples\Bin\Release\ and run UserTracker.net.exe 












Step 6:

At this moment we are going to run Unity3D engine (I assume you have a basic understanding of how the engine works).

First, we make a new project ( File->New Project ). I called mine "KinectFun".














Then you need to import the lovely Unity Package that you earlier downloaded from Zigfu website into your project (Assets->Import Package->Custom Package)

















Once imported you should see all the assets provided by zigfu under project.















Time to have some fun. Let’s open up the AvatarFrontFacing scene under “_Scene” folder. You should see a soldier in a T-pos.












Run the game. Once in the game, you need to calibrate the device by following the instructions in the game. 














That's all. I would recommend that you look at the scripts and sample scenes that is provided by Zigfu to better understand how the code works.

MAC

Step 1:

Following requirements are needed for this tutorial:
1- Microsoft's Kinect Device
2- Unity3D Engine(http://unity3d.com/)
3- Zigfu (http://zigfu.com/devtools.html)

Step 2:

Download both  DevBundle for Mac and Unity3d Bindings from Zigfu website.

Step 3:

Run 
ZigFuOpenNI2.0.pkg















After installation is over, you should have a folder called ZigFuOpenNI in your installation folder.






















Step 4:

Inside the ZigFuOpenNI, you need to run install.sh script in the terminal (Go->Utilities->Terminal). Once in terminal, you need to go to the ZigFuOpenNI and run the install.sh

In my case the ZigFuOpenNI is in Users\Hamed3D\ZigFuOpenNI

so I first type

cd ZigFuOpenNI

and then 

sudo sh install.sh























Once the installation is completed. you should see the following in your terminal:






































Step 5:

Try to check out some of the samples that come with these SDKs. For instance, to run the UserTracker.net demo example you need to type the following command in the terminal: 

sh test.sh

Step 6:

This part is exactly similar to part 6 above.





7 comments:

  1. Hello,

    My name is Tim, I'm a game developer from Brazil.
    Excellent tutorial about installing the kinect on a mac.

    Although, I'm still having some problems here. If you can take the time to help me, I would really appreciate it.

    Apparently the process worked just fine, but when I'm going to test it with the "sh test.sh" command, I got the error:

    test.sh: line 8: cd: OpenNI/Samples/Bin/x86-Release: No such file or directory
    test.sh: line 9: ./Sample-NiUserTracker: No such file or directory

    I tried to ignore that and test it on unity. The kinected started, the infrared cam turned on, I got some image feed, but 2 seconds later, the unity froze. I tested with all samples scenes and none seems to work.

    Any ideas?

    Thank you for your time and sorry for my awful english.
    Best Regards
    Tin

    ReplyDelete
  2. HI You shuold open test.sh with unitron or textedit and replace line "cd OpenNI/Samples/Bin/x86-Release" by "cd OpenNI/Samples/Bin/x64-Release"
    and it's work ;)

    But I have a problem in unity when I lunch AvatarFrontFacing scene I get this error DllNotFoundException:kinect10.dll any idea?

    Thanks

    ReplyDelete
  3. hi alexandre,

    I was not able to find ZigFuOpenNI2.0 on their website. it still ZigFuOpenNI1.0.1b something. Can you share that file.

    thanks

    ReplyDelete
  4. Worked like a charm. Thank you so much!

    ReplyDelete
  5. Hi there,

    Using any text editor to change the directory to "OpenNI/Samples/Bin/x64-Release" works like charm!

    Unfortunately it seems like Kinect is very unstable on MacOS (my current version is Yosemite 10.10), anyway, whether I run the OPENNI Samples or Unity samples, it kept crashing every 10 seconds.

    I event tried to install the newer version of OPENNI but I still got the same results. How's sad!

    I'm gonna try this again on Windows, will update the result soon!

    Cheers,

    ReplyDelete
  6. Now you need to install the SensorKinect driver. Simply go to driver's folders and run dpinst depending on your Windows 7 version. In my case, I am using windows 7 64 bits so I chose dpinst-amd64.exe

    \PrimeSense\SensorKinect\Driver\dpinst-amd64.exe

    I cant install this .exe

    ReplyDelete
  7. Unable to install driver from primesense, need help

    ReplyDelete