Пример #1
0
FileSkeleton::FileSkeleton(const std::string &filename)
{
    ifstream strm(filename.c_str());
  
    if(!strm.is_open()) {
        std::cout  << "Error opening file " << filename << endl;
        return;
    }

    while(!strm.eof()) {
        vector<string> line = readWords(strm);
        if(line.size() < 5)
            continue; //error

        Vector3 p;
        sscanf(line[1].c_str(), "%lf", &(p[0]));
        sscanf(line[2].c_str(), "%lf", &(p[1]));
        sscanf(line[3].c_str(), "%lf", &(p[2]));

        if(line[4] == "-1")
            line[4] = std::string();

        makeJoint(line[0], p * 2., line[4]);
    }

    initCompressed();
}
Пример #2
0
void PhysicsActor::trigger(MsbObject* other){

    Actor::trigger(other);

    if (other->name=="make joint"){
        makeJoint();
    }

//    dBodyDisable(body);
//    dBodySetDamping(body, linearDamp, angleDamp);
//    dBodyEnable(body);
}
Пример #3
0
void PhysicsActor::setup(){

    if (!bInit)
        postLoad();

    if (bJointedToBase){
        makeJoint();
    }

    angleDamp=0.9;
    linearDamp=0.2;

}
Пример #4
0
CentaurSkeleton::CentaurSkeleton()
{
    //order of makeJoint calls is very important
    makeJoint("shoulders",  Vector3(0., 0., 0.5));                      //0
    makeJoint("back",       Vector3(0., 0., 0.),         "shoulders");  //1
    makeJoint("hips",       Vector3(0., 0., -0.5),       "back");       //2

    makeJoint("hback",      Vector3(0., 0.25, 0.5),      "shoulders");  //3
    makeJoint("hshoulders", Vector3(0., 0.5, 0.5),       "hback");      //4
    makeJoint("head",       Vector3(0., 0.7, 0.5),       "hshoulders"); //5
    
    makeJoint("lthigh",     Vector3(-0.15, 0., -0.5),    "hips");       //6
    makeJoint("lhknee",     Vector3(-0.2, -0.4, -0.45),  "lthigh");     //7
    makeJoint("lhfoot",     Vector3(-0.2, -0.8, -0.5),   "lhknee");     //8
    
    makeJoint("rthigh",     Vector3(0.15, 0., -0.5),     "hips");       //9
    makeJoint("rhknee",     Vector3(0.2, -0.4, -0.45),   "rthigh");     //10
    makeJoint("rhfoot",     Vector3(0.2, -0.8, -0.5),    "rhknee");     //11
    
    makeJoint("lshoulder",  Vector3(-0.2, 0., 0.5),      "shoulders");  //12
    makeJoint("lfknee",     Vector3(-0.2, -0.4, 0.5),    "lshoulder");  //13
    makeJoint("lffoot",     Vector3(-0.2, -0.8, 0.5),    "lfknee");     //14
    
    makeJoint("rshoulder",  Vector3(0.2, 0.0, 0.5),      "shoulders");  //15
    makeJoint("rfknee",     Vector3(0.2, -0.4, 0.5),     "rshoulder");  //16
    makeJoint("rffoot",     Vector3(0.2, -0.8, 0.5),     "rfknee");     //17
    
    makeJoint("hlshoulder", Vector3(-0.2, 0.5, 0.5),     "hshoulders"); //18
    makeJoint("lelbow",     Vector3(-0.4, 0.25, 0.575),  "hlshoulder"); //19
    makeJoint("lhand",      Vector3(-0.6, 0.0, 0.65),    "lelbow");     //20
    
    makeJoint("hrshoulder", Vector3(0.2, 0.5, 0.5),      "hshoulders"); //21
    makeJoint("relbow",     Vector3(0.4, 0.25, 0.575),   "hrshoulder"); //22
    makeJoint("rhand",      Vector3(0.6, 0.0, 0.65),     "relbow");     //23

    makeJoint("tail",       Vector3(0., 0., -0.7),       "hips");       //24

    //symmetry
    makeSymmetric("lthigh", "rthigh");
    makeSymmetric("lhknee", "rhknee");
    makeSymmetric("lhheel", "rhheel");
    makeSymmetric("lhfoot", "rhfoot");
    
    makeSymmetric("lshoulder", "rshoulder");
    makeSymmetric("lfknee", "rfknee");
    makeSymmetric("lffoot", "rffoot");

    makeSymmetric("hlshoulder", "hrshoulder");
    makeSymmetric("lelbow", "relbow");
    makeSymmetric("lhand", "rhand");    
    
    initCompressed();

    setFoot("lhfoot");
    setFoot("rhfoot");
    setFoot("lffoot");
    setFoot("rffoot");

    setFat("hips");
    setFat("shoulders");
    setFat("hshoulders");
    setFat("head");
}
Пример #5
0
HorseSkeleton::HorseSkeleton()
{
    //order of makeJoint calls is very important
    makeJoint("shoulders",  Vector3(0., 0., 0.5));
    makeJoint("back",       Vector3(0., 0., 0.),         "shoulders");
    makeJoint("hips",       Vector3(0., 0., -0.5),       "back");
    makeJoint("neck",       Vector3(0., 0.2, 0.63),      "shoulders");
    makeJoint("head",       Vector3(0., 0.2, 0.9),       "neck");
    
    makeJoint("lthigh",     Vector3(-0.15, 0., -0.5),     "hips");
    makeJoint("lhknee",     Vector3(-0.2, -0.2, -0.45),  "lthigh");
    makeJoint("lhheel",     Vector3(-0.2, -0.4, -0.5),   "lhknee");
    makeJoint("lhfoot",     Vector3(-0.2, -0.8, -0.5),   "lhheel");
    
    makeJoint("rthigh",     Vector3(0.15, 0., -0.5),      "hips");
    makeJoint("rhknee",     Vector3(0.2, -0.2, -0.45),   "rthigh");
    makeJoint("rhheel",     Vector3(0.2, -0.4, -0.5),    "rhknee");
    makeJoint("rhfoot",     Vector3(0.2, -0.8, -0.5),    "rhheel");
    
    makeJoint("lshoulder",  Vector3(-0.2, 0., 0.5),      "shoulders");
    makeJoint("lfknee",     Vector3(-0.2, -0.4, 0.5),    "lshoulder");
    makeJoint("lffoot",      Vector3(-0.2, -0.8, 0.5),   "lfknee");
    
    makeJoint("rshoulder",  Vector3(0.2, 0.0, 0.5),      "shoulders");
    makeJoint("rfknee",     Vector3(0.2, -0.4, 0.5),     "rshoulder");
    makeJoint("rffoot",      Vector3(0.2, -0.8, 0.5),    "rfknee");
    
    makeJoint("tail",       Vector3(0., 0., -0.7),       "hips");
    
    //symmetry
    makeSymmetric("lthigh", "rthigh");
    makeSymmetric("lhknee", "rhknee");
    makeSymmetric("lhheel", "rhheel");
    makeSymmetric("lhfoot", "rhfoot");
    
    makeSymmetric("lshoulder", "rshoulder");
    makeSymmetric("lfknee", "rfknee");
    makeSymmetric("lffoot", "rffoot");
    
    initCompressed();

    setFoot("lhfoot");
    setFoot("rhfoot");
    setFoot("lffoot");
    setFoot("rffoot");

    setFat("hips");
    setFat("shoulders");
    setFat("head");
}
Пример #6
0
SmartBodySkeleton::SmartBodySkeleton()
{
	//order of makeJoint calls is very important
	makeJoint("shoulders",  Vector3(0., 0.5, 0.));                          //0
	makeJoint("spine3",     Vector3(0., 0.25, 0.),      "shoulders");       //1
	makeJoint("spine2",     Vector3(0., 0.10, 0.),      "spine3");       //2
	makeJoint("back",       Vector3(0., 0.05, 0.),      "spine2");       //3
	makeJoint("hips",       Vector3(0., 0., 0.),        "back");          //4
	makeJoint("neck",       Vector3(0., 0.65, 0.),      "shoulders");     //5
	makeJoint("skullbase",  Vector3(0., 0.68, 0.),       "neck");          //6
	makeJoint("head",       Vector3(0., 0.75, 0.),       "skullbase");     //7

	makeJoint("lthigh",     Vector3(-0.1, 0., 0.),      "hips");            //8
	makeJoint("lknee",      Vector3(-0.15, -0.35, 0.),  "lthigh");          //9
	makeJoint("lankle",     Vector3(-0.15, -0.8, 0.),  "lknee");           //10
	makeJoint("lfoot",      Vector3(-0.15, -0.85, 0.06),  "lankle");       //11
	makeJoint("ltoe",       Vector3(-0.15, -0.85, 0.1),   "lfoot");       //12

	makeJoint("rthigh",     Vector3(0.1, 0., 0.),       "hips");            //13
	makeJoint("rknee",      Vector3(0.15, -0.35, 0.),   "rthigh");          //14
	makeJoint("rankle",      Vector3(0.15, -0.8, 0.),   "rknee");           //15
	makeJoint("rfoot",      Vector3(0.15, -0.85, 0.06),   "rankle");        //16
	makeJoint("rtoe",      Vector3(0.15, -0.85, 0.1),   "rfoot");          //17

	makeJoint("lshoulder",  Vector3(-0.2, 0.5, 0.),     "shoulders");       //18
	makeJoint("lelbow",     Vector3(-0.4, 0.25, 0.075), "lshoulder");       //19
	makeJoint("lhand",      Vector3(-0.6, 0.0, 0.15),   "lelbow");          //20
	makeJoint("lthumb",      Vector3(-0.62, -0.03, 0.225),   "lhand");          //21


	makeJoint("rshoulder",  Vector3(0.2, 0.5, 0.),      "shoulders");       //22
	makeJoint("relbow",     Vector3(0.4, 0.25, 0.075),  "rshoulder");       //23
	makeJoint("rhand",      Vector3(0.6, 0.0, 0.15),    "relbow");          //24
	makeJoint("rthumb",      Vector3(0.62, -0.03, 0.225),   "rhand");          //25

	//symmetry
	makeSymmetric("lthigh", "rthigh");
	makeSymmetric("lknee", "rknee");
	makeSymmetric("lankle", "rankle");
	makeSymmetric("lfoot", "rfoot");
	makeSymmetric("ltoe", "rtoe");

	makeSymmetric("lshoulder", "rshoulder");
	makeSymmetric("lelbow", "relbow");
	makeSymmetric("lhand", "rhand");
	//makeSymmetric("lthumb", "rthumb");

	initCompressed();

	setFoot("ltoe");
	setFoot("rtoe");
	
	setFat("hips");
	setFat("shoulders");
	setFat("head");
	//setFat("rthumb");
	//setFat("lthumb");
	//setFat("skullbase");
}
Пример #7
0
HumanSkeleton::HumanSkeleton()
{
    //order of makeJoint calls is very important
    makeJoint("shoulders",  Vector3(0., 0.5, 0.));                          //0
    makeJoint("back",       Vector3(0., 0.15, 0.),      "shoulders");       //1
    makeJoint("hips",       Vector3(0., 0., 0.),        "back");            //2
    makeJoint("head",       Vector3(0., 0.7, 0.),       "shoulders");       //3
    
    makeJoint("lthigh",     Vector3(-0.1, 0., 0.),      "hips");            //4
    makeJoint("lknee",      Vector3(-0.15, -0.35, 0.),  "lthigh");          //5
    makeJoint("lankle",      Vector3(-0.15, -0.8, 0.),  "lknee");           //6
    makeJoint("lfoot",      Vector3(-0.15, -0.8, 0.1),  "lankle");          //7
    
    makeJoint("rthigh",     Vector3(0.1, 0., 0.),       "hips");            //8
    makeJoint("rknee",      Vector3(0.15, -0.35, 0.),   "rthigh");          //9
    makeJoint("rankle",      Vector3(0.15, -0.8, 0.),   "rknee");           //10
    makeJoint("rfoot",      Vector3(0.15, -0.8, 0.1),   "rankle");          //11
    
    makeJoint("lshoulder",  Vector3(-0.2, 0.5, 0.),     "shoulders");       //12
    makeJoint("lelbow",     Vector3(-0.4, 0.25, 0.075), "lshoulder");       //13
    makeJoint("lhand",      Vector3(-0.6, 0.0, 0.15),   "lelbow");          //14
    
    makeJoint("rshoulder",  Vector3(0.2, 0.5, 0.),      "shoulders");       //15
    makeJoint("relbow",     Vector3(0.4, 0.25, 0.075),  "rshoulder");       //16
    makeJoint("rhand",      Vector3(0.6, 0.0, 0.15),    "relbow");          //17
    
    //symmetry
    makeSymmetric("lthigh", "rthigh");
    makeSymmetric("lknee", "rknee");
    makeSymmetric("lankle", "rankle");
    makeSymmetric("lfoot", "rfoot");
    
    makeSymmetric("lshoulder", "rshoulder");
    makeSymmetric("lelbow", "relbow");
    makeSymmetric("lhand", "rhand");

    initCompressed();

    setFoot("lfoot");
    setFoot("rfoot");

    setFat("hips");
    setFat("shoulders");
    setFat("head");
}