当前位置: 首页>>代码示例>>C++>>正文


C++ Part::computeShapes方法代码示例

本文整理汇总了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;
}
开发者ID:SDavis13,项目名称:Nibbles,代码行数:57,代码来源:Debris.cpp


注:本文中的Part::computeShapes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。