This content corresponds to NtUnity.cs version 1.1 or later.
To Table of Contents"Unity Chan" package can be downloaded from the official site http://unity-chan.com/ . From the above site, download UnityChan_1_2.nitypackage by selecting "Download" -> "Guideline for using Characters" -> "3D Model Data of Unity Chan".
It seems to me that the internal coordinate system of "Unity Chan" 3D model data (unitychan.fbx) is fairly special. For each bone's Transform.rotation , rotate "first at -90 degree around the Z-axis and then 90 degree around the Y-axis" to reset the coordinate system, then move the original orientation in the global coordinate system it is necessary to set. In addition, Transfrom.rotation of the entire model also rotates "first at -90 degree aruond the Z-axis and then at -90 degree around the Y-axis" to reset the coordinate system, and then the orientation you want to set.
The model data of "Unity Chan" has a long hair from the head, so when the direction of the face changes and head moves, it is very conspicuous. Recognition of face orientation may fail, and it moves finaly because of error. If the head of "Unity Chan" reflects such moves as it is directly, you may feel very eyesore. Therefore, in the "Unity Chan" model, it seems more appropriate to move by using the average (moving average) and so on, instead of immediately following the change of the recognized face orientation.
The downloaded zip file does not necessarily contain the latest file. Please replace the following file with the new version.
Assets/Plugins/x86_64/NtKinectDLL.dll Assets/Scripts/NtUnity.cs
File -> New Scene
File -> Save Scene as ... -> Sample05.unity
When you import "Unity Chan" package, it can be seen as "Assets/UnityChan/".
If it is not "Humanoid", change it to "Humanoid".
Drag "Assets/UnityChan/Models/unitychan.fbx" to the Hierarchy. With the "unitychan" is selected in the Hierarchy window, click the "Reset" of Transform's settings in the Inspector window.
Above menu -& "Assets" -> "Create" -> "C# Script" -> Filename is "Sample05".
Sample05.cs |
|
[NOTICE] We generates an OpenCV window in DLL to display the skeleton recognition state. Note that when the OpenCV window is focused, that is, when the Unity game window is not focused, the screen of Unity will not change. Click on the top of Unity's window and make it focused, then try the program's behaviour.
Runtime Video UnityDLL05a.mp4, UnityDLL05b.mp4Since the above zip file may not include the latest "NtKinectDLL.dll" and "NtUnity.cs", Download the latest version from here and replace old one with it.