diff --git a/level.cc b/level.cc index 0a6f480..0bb82f5 100644 --- a/level.cc +++ b/level.cc @@ -213,6 +213,7 @@ void Level::load() { errorCheck(thisComposition->FirstChildElement("xRot")->QueryFloatText(&compRot[0])); errorCheck(thisComposition->FirstChildElement("yRot")->QueryFloatText(&compRot[1])); errorCheck(thisComposition->FirstChildElement("zRot")->QueryFloatText(&compRot[2])); + compRot *= 0.0174532925; //transform degrees to radians bool ignoreHeightmap; errorCheck(composition->FirstChildElement("ignoreHeightmap")->QueryBoolText(&ignoreHeightmap)); if (!ignoreHeightmap){ @@ -230,6 +231,7 @@ void Level::load() { errorCheck(xmlObject->FirstChildElement("xRot")->QueryFloatText(&objectRot[0])); errorCheck(xmlObject->FirstChildElement("yRot")->QueryFloatText(&objectRot[1])); errorCheck(xmlObject->FirstChildElement("zRot")->QueryFloatText(&objectRot[2])); + objectRot *= 0.0174532925; //transform degrees to radians Object* object = new Object(model, material, objectPosition, compRot+objectRot); objects.push_back(object); @@ -279,10 +281,7 @@ void Level::load() { errorCheck(objectData->FirstChildElement("length")->QueryFloatText(&length)); this->physics.addButton(width, height, length, *object, mass, dampningL, dampningA, physicObjects.size(), rotate); }else if (physicType.compare("TriangleMesh") == 0){ - this->physics.addTriangleMeshBody(*object, modelPath, mass, dampningL, dampningA, physicObjects.size(),objectScale, rotate); - }else if (physicType.compare("OuterSwitch") == 0){ - - //physicObjects.push_back(object); + this->physics.addTriangleMeshBody(*object, modelPath, mass, dampningL, dampningA, physicObjects.size(), objectScale, rotate); } else{ printf("XMLError: Not a valid physicType.\n"); exit(-1); @@ -386,11 +385,21 @@ void Level::load() { errorCheck(composition->FirstChildElement("idBlue")->QueryIntText(&idBlue)); errorCheck(xmlTrigger->FirstChildElement("objectNum")->QueryIntText(&objectNum)); Object* object=0; + bool ok = false; for (unsigned int i = 0; iFirstChildElement("luaScript")->GetText(); if(charLuaScript == NULL){ printf("XMLError: No Lua script found for a trigger.\n"); @@ -404,7 +413,7 @@ void Level::load() { errorCheck(xmlTrigger->FirstChildElement("toChangeObjNum")->QueryIntText(&toChangeObjNum)); for (unsigned int i = 0; i* Level::getObjects() { return &objects; } -void Level::deleteObject(int objectIndex){ - objects.erase(objects.begin() + objectIndex); - for(unsigned int i = 0; i