Hi Everyone,
We are LongGood Ltd,. We are dedicated to motion-sensing rehabilitation.
Unfortunately, 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 an plugin named KinectOneForZigFu. We share it to who use ZigFu and want to integrate KinectOne.
All other requirement about KinectOne you have to satisfy.
- Add KinectOneController GameObject
public GameObject kinectOneObject;
- Modify Awake()
void Awake()
{
#if UNITY_WEBPLAYER
#if UNITY_EDITOR
Debug.LogError("Depth camera input will not work in editor when target platform is Webplayer. Please change target platform to PC/Mac standalone.");
return;
#endif
#endif
DontDestroyOnLoad(this);
}
- Modify Start()
void Start()
{
ZigInput.Settings = settings;
if (inputType == ZigInputType.Auto || inputType == ZigInputType.OpenNI2)
{
IntPtr iPtr = IntPtr.Zero;
int pNumber = 0;
OpenNI2.OpenNI2Wrapper.OniStatus oniStatus = OpenNI2.OpenNI2Wrapper.oniGetDeviceList(ref iPtr, ref pNumber);
if (pNumber == 0)
{
print("No OpenNI2!!!!");
if (StartOpenNiORKinectSDK(ZigInputType.OpenNI) == false && StartOpenNiORKinectSDK(ZigInputType.KinectSDK) == false)
{
print("No Device!!!!");
OpenKinectOne();
}
return;
}
}
if (StartOpenNiORKinectSDK(inputType) == false)
{
print("No Device!!!!");
}
}
- Add following functions
bool StartOpenNiORKinectSDK(ZigInputType _inputType)
{
ZigInput.InputType = _inputType;
try
{
if (ZigInput.Instance.ReaderInited == true)
ZigInput.Instance.AddListener(gameObject);
print(ZigInput.Instance.GetGestures().ToString());
return true;
}
catch
{
print("Exception!! Can not open " + _inputType);
return false;
}
}
void OpenKinectOne()
{
try
{
kinectOneObject.SetActive(true);
}
catch
{
print("Setup KinectOne failed.");
}
}
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.