示例#1
0
    void Awake()
    {
        //this has to be done first. Inside the IisuUnityBehaviour object, iisu is initialized, and the update thread for the current device (camera, movie) is started
        _iisuUnity = GetComponent<IisuUnityBehaviour> ();
        _iisuUnity.Initialize ();

        //register iisu data needed to display the depthimage
        _depthImage = _iisuUnity.Device.RegisterDataHandle<Iisu.Data.IImageData> ("SOURCE.CAMERA.DEPTH.Image");

        _hand1ID = _iisuUnity.Device.RegisterDataHandle<int> ("CI.HAND1.Label");
        _hand2ID = _iisuUnity.Device.RegisterDataHandle<int> ("CI.HAND2.Label");
        _labelImage = _iisuUnity.Device.RegisterDataHandle<Iisu.Data.IImageData> ("CI.SceneLabelImage");

        _iisuUnity.Device.EventManager.RegisterEventListener("CI.HandPosingGesture", new OnPoseDelegate(OnPoseEvent));

        _poseIDsDetected = new List<uint>();
    }
    void Awake()
    {
        _iisuUnity = GetComponent<IisuUnityBehaviour>();
        _iisuUnity.Initialize("UnitySampleConfig.xml");

        //register a specific data from iisu to the datahandler
        _depthImage = _iisuUnity.Device.RegisterDataHandle<Iisu.Data.IImageData>("SOURCE.CAMERA.DEPTH.Image");
        _labelImage = _iisuUnity.Device.RegisterDataHandle<Iisu.Data.IImageData>("SCENE.LabelImage");
        _userImageID = _iisuUnity.Device.RegisterDataHandle<int>("USER1.SceneObjectID");
        _uiPointer = _iisuUnity.Device.RegisterDataHandle<Iisu.Data.Vector3>("UI.CONTROLLER1.POINTER.NormalizedCoordinates");
        _uiStatus = _iisuUnity.Device.RegisterDataHandle<bool>("UI.CONTROLLER1.IsActive");
        _user1Active = _iisuUnity.Device.RegisterDataHandle<bool>("USER1.IsActive");

        //in case UI is disabled, we enable UI to be sure.
        IParameterHandle<bool> _uiEnabled = _iisuUnity.Device.RegisterParameterHandle<bool>("UI.Enabled");
        _uiEnabled.Value = true;
        //enable the circle activation gesture, in case it's disabled
        IParameterHandle<bool> _cirlceEnabled = _iisuUnity.Device.RegisterParameterHandle<bool>("UI.CONTROLLERS.GESTURES.CIRCLE.Enabled");
        _cirlceEnabled.Value = true;
    }