Beispiel #1
0
    void Start()
    {
        style = new GUIStyle();
        style.normal.textColor = Color.black;

        int count = MoveManager.GetNumConnected();

        for (int i = 0; i < count; i++)
        {
            MoveManager move = gameObject.AddComponent <MoveManager>();

            if (!move.Init(i))
            {
                Destroy(move);
                continue;
            }

            PSMoveConnectionType conn = move.ConnectionType;

            if (conn == PSMoveConnectionType.Unknown || conn == PSMoveConnectionType.USB)
            {
                Destroy(move);
            }
            else
            {
                moves.Add(move);
                move.OnControllerDisconnected += HandleControllerDisconnected;
                move.SetLED(Color.cyan);

                DisplayedPosition = new Vector3(0.0f, 1.0f, 0.0f);
                TransformMatrix   = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one);

                // The proposed algorithm’s adjustable parameter, ß, was set to 0.033 for the MARG
                // implementation and 0.041 for the IMU implementation.
                //AHRS = new AHRS.MadgwickAHRS(1f / 75f, 0.1f);
                AHRS = new AHRS.MadgwickAHRS(1f / 75f, 0.033f);
            }
        }
    }