Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice

KinectOne for ZigFu

Discussion in 'Assets and Asset Store' started by josephMG, Sep 4, 2015.

  1. josephMG

    josephMG

    Joined:
    Sep 4, 2015
    Posts:
    1
    KinectOneForZigFu GitHub

    Introducion

    Hi Everyone,

    We are LongGood Ltd,. We are dedicated to motion-sensing rehabilitation.

    Kinect360 has been discontinued and KinectOne is higher quality than Xtion and Kinect. So we decide to use KinectOne to be one of our choice. After studying Zig's structure, We implement a plugin named KinectOneForZigFu. Now, we share it to who use ZigFu and want to integrate KinectOne.

    Requirement
    All other requirement about KinectOne you have to satisfy.

    Modification


    First of all, you have to modify zig.cs.
    • Add KinectOneController GameObject
    Code (CSharp):
    1. public GameObject kinectOneObject;
    • Modify Awake()
    Code (CSharp):
    1.     void Awake()
    2.     {
    3.  
    4. #if UNITY_WEBPLAYER
    5. #if UNITY_EDITOR
    6.         Debug.LogError("Depth camera input will not work in editor when target platform is Webplayer. Please change target platform to PC/Mac standalone.");
    7.         return;
    8. #endif
    9. #endif
    10.  
    11.         DontDestroyOnLoad(this);
    12.     }
    • Modify Start()
    Code (CSharp):
    1.    void Start()
    2.     {
    3.         ZigInput.Settings = settings;
    4.         if (inputType == ZigInputType.Auto || inputType == ZigInputType.OpenNI2)
    5.         {
    6.             IntPtr iPtr = IntPtr.Zero;
    7.             int pNumber = 0;
    8.             OpenNI2.OpenNI2Wrapper.OniStatus oniStatus = OpenNI2.OpenNI2Wrapper.oniGetDeviceList(ref iPtr, ref pNumber);
    9.             if (pNumber == 0)
    10.             {
    11.                 print("No OpenNI2!!!!");
    12.                 if (StartOpenNiORKinectSDK(ZigInputType.OpenNI) == false && StartOpenNiORKinectSDK(ZigInputType.KinectSDK) == false)
    13.                 {
    14.                     print("No Device!!!!");
    15.                     OpenKinectOne();
    16.                 }
    17.                 return;
    18.             }
    19.         }
    20.         if (StartOpenNiORKinectSDK(inputType) == false)
    21.         {
    22.             print("No Device!!!!");
    23.         }
    24.  
    25.     }
    • Add following functions
    Code (CSharp):
    1. bool StartOpenNiORKinectSDK(ZigInputType _inputType)
    2.     {
    3.         ZigInput.InputType = _inputType;
    4.         try
    5.         {
    6.             if (ZigInput.Instance.ReaderInited == true)
    7.                 ZigInput.Instance.AddListener(gameObject);
    8.             print(ZigInput.Instance.GetGestures().ToString());
    9.             return true;
    10.         }
    11.         catch
    12.         {
    13.             print("Exception!! Can not open " + _inputType);
    14.             return false;
    15.         }
    16.     }
    17.     void OpenKinectOne()
    18.     {
    19.         try
    20.         {
    21.             kinectOneObject.SetActive(true);
    22.         }
    23.         catch
    24.         {
    25.             print("Setup KinectOne failed.");
    26.         }
    27.     }
    Second, add KinectOneController prefabs to Hierarchy:



    Third, Set KinectOneController to ZigFu GameObject:



    Finally, Set Zigfu and Blockman user to KinectOneToZig:



    Okay, done.:)

    Plug in your KinectOne and OnGui will show the depth view or removal background color image depends on whether user is tracked or not.
     
  2. ecj2000

    ecj2000

    Joined:
    Aug 12, 2016
    Posts:
    2
    Hi~
    I'm trying to KinectOneForZigFu, zigfu SampleScenes for excute.
    But continually failed for a week.
    please show following error message.

    Failed to load driver and middleware, review warnings above for specific exception messages from middleware
    UnityEngine.Debug:LogError(Object)
    ZigInput:Awake()
    UnityEngine.GameObject:AddComponent()
    ZigInput:get_Instance()
    ZigEngageSingleUser:Start() (at Assets/ZigFu/Scripts/UserEngagers/ZigEngageSingleUser.cs:18)

    DllNotFoundException: OpenNI2.dll
    Zig.Start () (at Assets/ZigFu/Scripts/Zig.cs:43)

    Please reply my question.
    with best regards.

     
unityunity