Ejemplo n.º 1
0
    void Awake()
    {
        centerCoords = new Vector3(0, 0, 0);

        int nAvatars = playerNameList.Count;

        gos = new GameObject[nAvatars];

        for (int i = 0; i < gos.Length; i++)
        {
            GameObject clone = (GameObject)Instantiate(prefab, Vector3.zero, Quaternion.identity);
            ikavatar              = clone.GetComponent <IKAvatar>();
            ikavatar.playerName   = playerNameList[i];
            ikavatar.trialIndex   = trialIndexList[i];
            ikavatar.offsetCoords = i * offsetCoords;
            ikavatar.modelColor   = avatarColorList[i];
            gos[i] = clone;
        }
        prefab.SetActive(false);
    }
Ejemplo n.º 2
0
    void Start()
    {
        ikavatar     = GetComponentInParent <IKAvatar>();
        lines        = ikavatar.lines;
        offsetVector = ikavatar.offsetCoords;
        trialIndex   = ikavatar.trialIndex;

        // tracker type now defines which rows to read in from the test file
        switch (trackerType)
        {
        case "torso":
            rowTriadIndex = 0;
            break;

        case "leftHand":
            rowTriadIndex = 1;
            break;

        case "rightHand":
            rowTriadIndex = 2;
            break;

        case "leftFoot":
            rowTriadIndex = 3;
            break;

        case "rightFoot":
            rowTriadIndex = 4;
            break;

        default:
            print("incorrect tracker definition.");
            break;
        }

        string XcoordsLine    = lines[rowTriadIndex * 3];
        string YcoordsLine    = lines[rowTriadIndex * 3 + 2];
        string ZcoordsLine    = lines[rowTriadIndex * 3 + 1];
        string trialIndexLine = lines[15];

        trialIndices = trialIndexLine.Split(',');

        var indices = new List <int>();

        for (int i = 0; i < trialIndices.Length; i++)
        {
            if (trialIndices[i].Equals(trialIndex.ToString()))
            {
                indices.Add(i);
            }
        }

        xcoords = XcoordsLine.Split(',');
        ycoords = YcoordsLine.Split(',');
        zcoords = ZcoordsLine.Split(',');

        List <string> xList = xcoords.OfType <string>().ToList();
        List <string> yList = ycoords.OfType <string>().ToList();
        List <string> zList = zcoords.OfType <string>().ToList();

        xList = MiscUtils.IndexList(xList, indices);
        yList = MiscUtils.IndexList(yList, indices);
        zList = MiscUtils.IndexList(zList, indices);

        xcoords = xList.ToArray();
        ycoords = yList.ToArray();
        zcoords = zList.ToArray();
    }