本文整理汇总了C++中Obstacle::setPointsCollision方法的典型用法代码示例。如果您正苦于以下问题:C++ Obstacle::setPointsCollision方法的具体用法?C++ Obstacle::setPointsCollision怎么用?C++ Obstacle::setPointsCollision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obstacle
的用法示例。
在下文中一共展示了Obstacle::setPointsCollision方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadFromXml
void Scenario::loadFromXml(ofxBulletWorldRigid &world){
ofxXmlSettings ScenarioXml;
if(ScenarioXml.loadFile(PinballChinoManager::projectName+"/scenario.xml")){
ScenarioXml.pushTag("scenario");
int numberOfSavedObjects = ScenarioXml.getNumTags("object");
for(int i = 0; i < numberOfSavedObjects; i++){
ScenarioXml.pushTag("object", i);
SimpleObject::shapeType Type = (SimpleObject::shapeType)ScenarioXml.getValue("type", 0);
int objId = ScenarioXml.getValue("id", 0);
ofVec3f pos, scale;
pos.x = ScenarioXml.getValue("positionX",0.0, 0);
pos.y = ScenarioXml.getValue("positionY",0.0, 0);
pos.z = ScenarioXml.getValue("positionZ",0.0, 0);
scale.x = ScenarioXml.getValue("scaleX",0.0, 0);
scale.y = ScenarioXml.getValue("scaleY",0.0, 0);
scale.z = ScenarioXml.getValue("scaleZ",0.0, 0);
ofQuaternion rotation;
ofVec4f rot;
rot.x = ScenarioXml.getValue("rotationX",0.0,0);
rot.y = ScenarioXml.getValue("rotationY",0.0,0);
rot.z = ScenarioXml.getValue("rotationZ",0.0,0);
rot.w = ScenarioXml.getValue("rotationW",0.0,0);
rotation.set(rot);
string path;
path = ScenarioXml.getValue("path","", 0);
//TODO uncomment the line below when the xml is properly configured
//string strcolor = ScenarioXml.getValue("color", "0xFFFFFF", 0);
int color = ScenarioXml.getValue("color", 0xFFFFFF, 0);
int pointsCollision = ScenarioXml.getValue("pointsCollision", 0, 0);
int invisible = 0; // Visible by default event if this value is not implemented in the Xml editor
invisible = ScenarioXml.getValue("invisible", 0, 0);
switch(Type){
case SimpleObject::ShapeTypeBall:{
Ball *oBall = new Ball(currentMissions);
float mass = ScenarioXml.getValue("mass", 0.0);
float radius = ScenarioXml.getValue("radius", 0.0);
float restitution = ScenarioXml.getValue("restitution", 0.0);
float friction = ScenarioXml.getValue("friction", 0.0);
oBall->setup(world, pos, mass, radius, restitution, friction);
oBall->SetObjectId(objId);
oBall->setRotation(rotation);
oBall->color = color;
oBall->setVisibility(invisible);
ScenarioObjects.push_back(oBall);
}
break;
case SimpleObject::ShapeTypeHammer:{
Hammer *oHammer = new Hammer(currentMissions);
oHammer->setup(world, pos);
oHammer->SetObjectId(objId);
oHammer->setRotation(rotation);
oHammer->color = color;
oHammer->setVisibility(invisible);
ScenarioObjects.push_back(oHammer);
oHammer->setupRot();
}
break;
case SimpleObject::ShapeTypeLever:{
Lever *oLever = new Lever(currentMissions);
int dir = ScenarioXml.getValue("LeverType", 0);
oLever->setup(world, pos, path, scale, dir);
oLever->SetObjectId(objId);
oLever->setRotation(rotation);
oLever->color = color;
oLever->setVisibility(invisible);
ScenarioObjects.push_back(oLever);
}
break;
case SimpleObject::ShapeTypeObstacle:{
Obstacle *oObstable = new Obstacle(currentMissions);
//oObstable->setup(world, pos, "3DModels/chino_6.dae");
oObstable->setup(world, pos, path, scale);
oObstable->SetObjectId(objId);
oObstable->setRotation(rotation);
oObstable->color = color;
oObstable->setVisibility(invisible);
ScenarioObjects.push_back(oObstable);
oObstable->setPointsCollision(pointsCollision);
//.........这里部分代码省略.........