本文整理汇总了C++中Part::computeShapes方法的典型用法代码示例。如果您正苦于以下问题:C++ Part::computeShapes方法的具体用法?C++ Part::computeShapes怎么用?C++ Part::computeShapes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part::computeShapes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void Debris::initialize(int type, b2Vec2 initialVelocity){
std::string name = "";
b2FixtureDef fixDef;
b2BodyDef bodDef;
if(type == RANDOM)
type = randDebrisType();
switch(type){
case DEBRIS1:
/*name = "debris1";
fixDef.density = 1;
fixDef.friction = 0.4;
hp = 0.1f;
energy = 0.1;
break;*/
case DEBRIS3:
/*name = "debris3";
fixDef.density = 0.9;
fixDef.friction = 0.45;
hp = 0.1f;
energy = 0.1;
break;*/
case DEBRIS2:
name = "debris2";
fixDef.density = 1.2;
fixDef.friction = 0.3;
hp = 0.1f;
energy = 0.1;
break;
case CANISTER:
name = "energycanister";
fixDef.density = 0.2;
fixDef.friction = 0.2;
hp = 0.5f;
energy = 2;
break;
default:
name = "debris2";
fixDef.density = 1;
hp = 0.1;
energy = 0.1;
break;
}
m_contacting = 0;
fixDef.restitution = 0.7;
Part* debrisPart = new Part(*this, meshes[name], glm::vec3(0), glm::vec3(0,1,0), 0, glm::vec3(1));
bodDef.type = b2_dynamicBody;
bodDef.position = b2Vec2(position.x, position.y);
bodDef.angle = angle*M_PI/180;
bodDef.linearVelocity = initialVelocity;
std::vector<b2Shape*> shapes = debrisPart->computeShapes(false, 0);
debrisPart->initialize(shapes, fixDef, bodDef);
primeBody = debrisPart->body;
primeBody->SetUserData((Entity*) this);
mass = primeBody->GetMass();
physValid = true;
damage = false;
}