コード例 #1
0
void Character::throwEntity(){
    Cube* cube = dynamic_cast<Cube*>(takenEntity[1]);
    cube->setCollide(false);
    cube->setV0(((shotForce)*vector3(dir[0],dir1,dir[2]))*(1/cube->getMass())*0.5);
    takenEntity[1]->setPos(pos+vector3(0.0,1.4+dir1,0.0)+dir*2);
    entityList->insert(++(entityList->begin()),takenEntity[1]); //insert after the first element
    takenEntity[1] = NULL;
}
コード例 #2
0
void Character::releaseEntity(){
    Cube* cube = dynamic_cast<Cube*>(takenEntity[1]);
    ///TODO
    /*GLfloat angle = dir[2]/(dir.length());
    angle = (acos(angle)/3.14)*180.0;
    cout << angle << endl;
    cube->setAngle(angle + cube->getAngle());*/
    cube->setCollide(false);
    cube->setV0(releaseForce*(1/cube->getMass())*0.5);
    takenEntity[1]->setPos(pos+vector3(0.0,1.0+dir1,0.0)+dir*2);
    //cout << takenEntity->getPos() << endl;
    entityList->insert(++(entityList->begin()),takenEntity[1]); //insert after the first element
    takenEntity[1] = NULL;
}