//Read the pose files and store it in the poseList
    public void initializePoseList()
    {
        poseList.Clear();

        for (int i = 1; i <= numRecord; i++)
        {
            string       newId;
            Vector3[]    newPos = new Vector3[_numJoints];
            Quaternion[] newRot = new Quaternion[_numJoints];
            Vector3      newOff;
            Vector3[]    newPosB = new Vector3[_numBones];
            Quaternion[] newRotB = new Quaternion[_numBones];
            string       pathout = "Assets/Files/record_" + i + ".txt";
            //set false so it will generate a new file every time.
            StreamReader sr = new StreamReader(pathout, false);

            newId = i.ToString();
            //Positions durchgehen
            for (int p = 0; p < _numJoints; p++)
            {
                newPos[p] = StringToVector3(sr.ReadLine());
            }
            //Rotations durchgehen
            for (int r = 0; r < _numJoints; r++)
            {
                newRot[r] = StringToQuaternion(sr.ReadLine());
            }
            //Offset
            newOff = StringToVector3(sr.ReadLine());
            //Bones durchgehen
            for (int bP = 0; bP < _numBones; bP++)
            {
                newPosB[bP] = StringToVector3(sr.ReadLine());
            }
            for (int bR = 0; bR < _numBones; bR++)
            {
                newRotB[bR] = StringToQuaternion(sr.ReadLine());
            }
            //add new pose to List
            pose newPose = new pose(newId, newPos, newRot, newOff, newPosB, newRotB);
            poseList.Add(newPose);
            sr.Close();
            sr.Dispose();
        }
    }
Example #2
0
	void LerpPose(pose p, float weight){
		for (int d =0; d<5; d++){
			for (int j=0; j<3;j++){
				if (fingers.digits[d].xfm[j] != null)
					fingers.digits[d].xfm[j].localRotation = Quaternion.Slerp(morphs.poseOpen.digits[d].rotations[j],p.digits[d].rotations[j],weight);
			}
		}
	}
Example #3
0
	public void SnapToPose(pose src, pose dst){
		for (int d =0; d<5; d++){
			for ( int j =0; j<3;j++){
				// currently we only reference the rotations property of poses.		
				dst.digits[d].xfm[j].localRotation = src.digits[d].rotations[j];
			}
		}	
	}
Example #4
0
	public void FlipPose(pose p){ // flip the handedness of the poses by negating y and z values
		for (int d =0; d<5; d++){
			for ( int j =0; j<3;j++){
				// currently we only reference the rotations property of poses.	
				p.digits[d].rotations[j].y = -p.digits[d].rotations[j].y;
				p.digits[d].rotations[j].z = -p.digits[d].rotations[j].z;
			}
		}		
	}
Example #5
0
	public void SampleRotations(pose dst){ // copy the current transform local rotations into a pose
		// this is used when recording up the poses from the editor or an animation pose file.
		for (int d =0; d<5; d++){
			for ( int j =0; j<3;j++){
				// currently we only reference the rotations property of poses.		
				dst.digits[d].rotations[j]=fingers.digits[d].xfm[j].localRotation;
			}
		}		
	}