public void Init()
    {
        //check if the scene is a game scene
        Game game = FindObjectOfType <Game>();

        if (game != null)
        {
            game.OnGameFinished += Close;
        }

        bodyDisplay = BodyDisplay.Instance;

        int count = Device.GetInstalledCount();

        if (count == 0)
        {
            Debug.Log("No k4a devices attached!\n");
            return;
        }

        // Open the first plugged in Kinect device
        device = Device.Open();
        if (device == null)
        {
            Debug.Log("Failed to open k4a device!\n");
            return;
        }

        string serial = device.SerialNum;

        Debug.Log("Opened device:" + serial);

        var config = new DeviceConfiguration
        {
            ColorResolution        = colorResolution,
            ColorFormat            = imageFormat,
            DepthMode              = depthMode,
            CameraFPS              = fps,
            SynchronizedImagesOnly = syncronizedImagesOnly
        };

        device.StartCameras(config);
        device.StartImu();
        calibration    = device.GetCalibration(depthMode, colorResolution);
        transformation = calibration.CreateTransformation();
        colourWidth    = calibration.ColorCameraCalibration.ResolutionWidth;
        colourHeight   = calibration.ColorCameraCalibration.ResolutionHeight;

        Debug.Log("Kinect started successfully");
        //Task.Run(() => ImuCapture());

        AppManager.applicationRunning = true;
    }
Beispiel #2
0
	void Start () {
        _instance = this;
        sprite = this.GetComponent<UISprite>();
	}
Beispiel #3
0
    /*
     *
     * private void OnSceneGUI()
     * {
     *  //Handles.DrawLine(Vector3.one, Vector3.zero);
     *
     *  //Debug.Log(jC.posA + "   " + jC.posB);
     *
     *  if (skeletonDisplay == null)
     *  {
     *      return;
     *  }
     *
     *  List<JointConnection> jointConnections = skeletonDisplay.ResolveSkeleton();
     *  Handles.color = Color.green;
     *  for (int i = 0; i < jointConnections.Count; i++)
     *  {
     *      JointConnection jC = jointConnections[i];
     *      if(jC.posA != null && jC.posB != null)
     *      {
     *          if(jC.posA != Vector3.zero || jC.posB != Vector3.zero)
     *          {
     *              Debug.Log(jC.posA);
     *          }
     *          Handles.DrawLine(jC.posA, jC.posB);
     *      }
     *  }
     * }*/

    private void OnEnable()
    {
        //EditorApplication.update += OnSceneGUI;
        skeletonDisplay = target as BodyDisplay;
    }