Пример #1
0
        public void Start()
        {
            _moveCount = PSMoveapiCsharp.count_connected();
            _tracker = new PSMoveTracker();
            Debug.Log (_moveCount);
            for (int i = 0; i < _moveCount; i++)
            {
                var move = new PSMove(i);
                move.enable_orientation(PSMove_Bool.PSMove_True);

                if (_enableTracker) {
                    var status = _tracker.enable(move);
                    while (status != Status.TrackerCalibrated)
                    {
                        print("er");
                    }

                    Debug.Log(status);

                    byte r, g, b;
                    _tracker.get_color (move, out r, out g, out b);
                    move.set_leds(r, g, b);
                    move.update_leds();
                }

                var moveControllerGameObject = Instantiate(MoveControllerPrefab) as Transform;
                if (moveControllerGameObject != null)
                {
                    var moveController = moveControllerGameObject.GetComponent<PSMoveController>();
                    moveController.Move = move;
                    if (_enableTracker) {
                        moveController.Tracker = _tracker;
                    }
                }

                _moves.Add(move);
            }

            if (_moveCount > 0)
            {
                new Thread(Poll).Start();
            }
        }
Пример #2
0
    // Use this for initialization
    public void Start()
    {
        _move = new PSMove();

        _tracker = new PSMoveTracker();
        _tracker.enable(_move);
        _tracker.set_mirror(1);

        PSMoveapiCsharp.psmove_enable_orientation(_move, PSMove_Bool.PSMove_True);

        _testThread = new Thread(CalculateTranslation);
        _testThread.Start();

        new Thread(() =>
            {
                while (_runThread)
                {
                    _move.poll();
                }
            }).Start();
    }