How to Use KinectManager across Multiple Scenes
-如何在多个场景中使用KinectManager
In order to use KinectManager across multiple scenes, it must be attached to a game object that is created only once during the game, not destroyed and available in all scenes. In this case the MainCamera is not a good choice. If this is your case, do as follows:
-为了在多个场景中使用KinectManager,KinectManager必须被添加到项目中唯一生成、不被销毁、所有场景可见的对象上。在这个例子中,放在了主相机(MainCamera)上,不是一个很好的选择。假如举的例子是你的范本,如下行事:
1.Create a new scene and name it ‘StartupScene’. Set it as the 1st scene to be executed, in the project’s build settings.-创建一个新场景,命名为“StartupScene”。在项目的Build Settings(File->Build Settings,将场景拖入即可)里面把它设置为第一个执行的场景。
2.Open the StartupScene.-打开启动场景
3.Create an empty game object and name it ‘KinectObject’.-新建一个空对象,命名为“KinectObject”
4.Attach the KinectManager there and modify its settings as needed. You can also attach the InteractionManager, SpeechManager or FacetrackingManager, if you need them.-添加KinectManager到这个对象上,按需求修改配置。如果有需要,你也可以添加InteractionManager, SpeechManager 或者FacetrackingManager。
5.Attach KinectScripts/Extras/LoadMainLevel-script to KinectObject. This script will simply load the next scene, right after Kinect-sensor has been initialized. -在KinectObject这个对象上添加KinectScripts/Extras/路径下的LoadMainLevel脚本。这个脚本将在Kinect感应器被初始化后,简单的加载下个场景。
* 6.Save StartupScene.* -保存启动场景(快捷键:Ctrl+s)
* 7.Open any of the other scenes.* -打开其他场景
* 8.Make sure KinectManager (and all other Managers) are removed from MainCamera.* -确保主相机上的 KinectManager(以及其他所有的Manager类)脚本已经被移除。
* 9.If you need avatars in your scene, set up the avatars as in the example. Don’t forget to attach KinectScripts/AvatarController-script to each avatar. Additionally attach KinectScripts/Extras/SetSceneAvatars-script to the MainCamera. It will automatically add the scene avatars to the Player-1 avatars’ list of KinectManager at the scene start-up.* -如果在你的场景中你需要骨骼动画,就像示例那样设置这个骨骼动画。不要忘记对每个骨骼动画添加KinectScripts/路径下的AvatarController脚本。此外,添加KinectScripts/Extras/路径下的SetSceneAvatars脚本到主相机上。它将在场景开始时自动地把场景中所有的骨骼动画添加到Player-1 avatars的列表中。
* 10.If you need to invoke a public function from KinectManager in your scripts, use the following line to get reference to KinectManager: ‘KinectManager kinectManager = KinectManager.Instance;’. You can get reference to the the InteractionManager, SpeechManager or FacetrackingManager in the same way.* -如果你需要在你的脚本中调用KinectManager中的公共方法,请使用下面一行代码来获取KinectManager的引用:“KinectManager kinectManager = KinectManager.Instance;”。你可以用同样的方式获取到InteractionManager,SpeechManager 或者 FacetrackingManager的引用。
Support, Examples and Feedback
-支持,案例和反馈
E-mail: rumen.filkov@gmail.com, Skype, Twitter: roumenf, Whats App: on request
/*
注: WhatsNew-Kinect-MsSdk.pdf是介绍该插件从1.1到1.9的改动的,故不翻译。
Kinect需要2.0的,链接在这里:http://www.ceeger.com/forum/read.php?tid=31699#read_494021
*/