[Opal-commits] opal/samples/car main.cpp,1.22,1.23
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-03-01 05:05:00
|
Update of /cvsroot/opal/opal/samples/car In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21242/samples/car Modified Files: main.cpp Log Message: fixed bugs in xml blueprint loading; added ragdoll xml file to sample app Index: main.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/car/main.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** main.cpp 26 Feb 2005 10:22:22 -0000 1.22 --- main.cpp 1 Mar 2005 05:04:19 -0000 1.23 *************** *** 87,96 **** gGround->addShape(planeData); ! //create ramp opal::Matrix44r rampTransform; rampTransform.translate(0.0, 0.0, -60.0); rampTransform.rotate(-78.0, 1.0, 0.0, 0.0); ! BoxObject* box = new BoxObject(gSimulator, true, opal::Vec3r(6.0, 65.0, 1.0), ! opal::defaults::material, rampTransform); gObjects.push_back(box); --- 87,101 ---- gGround->addShape(planeData); ! // Create a ramp. ! opal::Solid* s = gSimulator->createSolid(); ! s->setStatic(true); opal::Matrix44r rampTransform; rampTransform.translate(0.0, 0.0, -60.0); rampTransform.rotate(-78.0, 1.0, 0.0, 0.0); ! s->setTransform(rampTransform); ! opal::BoxShapeData boxData; ! boxData.dimensions = opal::Vec3r(6, 65, 1); ! s->addShape(boxData); ! BoxObject* box = new BoxObject(gSimulator, s, boxData.dimensions); gObjects.push_back(box); *************** *** 164,171 **** } ! void BuildWall(const opal::Matrix44r& transform, const opal::Vec3r& blockSize, int length, int height) { opal::Matrix44r M; - //opal::Space* space = gSimulator->createSpace(); for (int l=0; l<length; ++l) --- 169,176 ---- } ! void BuildWall(const opal::Matrix44r& transform, const opal::Vec3r& blockSize, ! int length, int height) { opal::Matrix44r M; for (int l=0; l<length; ++l) *************** *** 179,231 **** } - //M.makeTranslation(pos[0], pos[1], pos[2]); //base wall transform M = transform; ! M.translate(l*blockSize[0] + 0.5*blockSize[0] - 0.5*length*blockSize[0] + offset, h*blockSize[1] + 0.5*blockSize[1], 0.0); ! //if (randbit()) ! if (1) ! { ! //normal size ! BoxObject* newBox = new BoxObject(gSimulator, false, blockSize, ! opal::globals::metalMaterial, M); ! newBox->setSleeping(true); ! gObjects.push_back(newBox); ! } ! else ! { ! //break it up into smaller blocks ! opal::Vec3r newSize = blockSize; ! newSize[0] *= 0.5; ! newSize[1] *= 0.5; ! ! //block 1 - lower left ! M.translate(-0.25*blockSize[0], -0.25*blockSize[1], 0.0); ! BoxObject* newBox = new BoxObject(gSimulator, false, newSize, ! opal::globals::metalMaterial, M); ! newBox->setSleeping(true); ! gObjects.push_back(newBox); ! ! //block 2 - lower right ! M.translate(0.5*blockSize[0], 0.0, 0.0); ! newBox = new BoxObject(gSimulator, false, newSize, ! opal::globals::metalMaterial, M); ! newBox->setSleeping(true); ! gObjects.push_back(newBox); ! ! //block 3 - upper right ! M.translate(0.0, 0.5*blockSize[1], 0.0); ! newBox = new BoxObject(gSimulator, false, newSize, ! opal::globals::metalMaterial, M); ! newBox->setSleeping(true); ! gObjects.push_back(newBox); ! ! //block 4 - upper left ! M.translate(-0.5*blockSize[0], 0.0, 0.0); ! newBox = new BoxObject(gSimulator, false, newSize, ! opal::globals::metalMaterial, M); ! newBox->setSleeping(true); ! gObjects.push_back(newBox); ! } } } --- 184,200 ---- } M = transform; ! M.translate(l*blockSize[0] + 0.5*blockSize[0] - ! 0.5*length*blockSize[0] + offset, h*blockSize[1] + 0.5*blockSize[1], 0.0); ! opal::Solid* s = gSimulator->createSolid(); ! s->setTransform(M); ! s->setSleeping(true); ! opal::BoxShapeData boxData; ! boxData.dimensions = blockSize; ! s->addShape(boxData); ! BoxObject* box = new BoxObject(gSimulator, s, boxData.dimensions); ! gObjects.push_back(box); } } *************** *** 493,505 **** case SDLK_SPACE: { opal::Matrix44r M = gCar->getTransform(); M.translate(0.0, 1.0, -3.0); ! SphereObject* projectile = new SphereObject(gSimulator, false, ! 0.6, opal::defaults::material, M); opal::Force f; f.vec = opal::Vec3r(0, 300, -1200); f.type = opal::LOCAL_FORCE; f.duration = (opal::real)0.01; ! projectile->getSolid()->addForce(f); gObjects.push_back(projectile); break; --- 462,485 ---- case SDLK_SPACE: { + // Figure out where to create the projectile. opal::Matrix44r M = gCar->getTransform(); M.translate(0.0, 1.0, -3.0); ! ! // Create a projectile. ! opal::Solid* s = gSimulator->createSolid(); ! s->setTransform(M); ! opal::SphereShapeData sphereData; ! sphereData.radius = (opal::real)0.6; ! s->addShape(sphereData); ! SphereObject* projectile = new SphereObject(gSimulator, s, ! sphereData.radius); ! ! // Apply a force to the projectile. opal::Force f; f.vec = opal::Vec3r(0, 300, -1200); f.type = opal::LOCAL_FORCE; f.duration = (opal::real)0.01; ! s->addForce(f); ! gObjects.push_back(projectile); break; |