- Timestamp:
- Apr 8, 2009, 12:58:47 AM (16 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/bullet/BulletDynamics/Dynamics/Bullet-C-API.cpp
r2907 r2908 111 111 { 112 112 btDynamicsWorld* dynamicsWorld = reinterpret_cast< btDynamicsWorld* >(world); 113 btAssert(dynamicsWorld);113 assert(dynamicsWorld); 114 114 dynamicsWorld->stepSimulation(timeStep); 115 115 } … … 118 118 { 119 119 btDynamicsWorld* dynamicsWorld = reinterpret_cast< btDynamicsWorld* >(world); 120 btAssert(dynamicsWorld);121 btRigidBody* body = reinterpret_cast< btRigidBody* >(object); 122 btAssert(body);120 assert(dynamicsWorld); 121 btRigidBody* body = reinterpret_cast< btRigidBody* >(object); 122 assert(body); 123 123 124 124 dynamicsWorld->addRigidBody(body); … … 128 128 { 129 129 btDynamicsWorld* dynamicsWorld = reinterpret_cast< btDynamicsWorld* >(world); 130 btAssert(dynamicsWorld);131 btRigidBody* body = reinterpret_cast< btRigidBody* >(object); 132 btAssert(body);130 assert(dynamicsWorld); 131 btRigidBody* body = reinterpret_cast< btRigidBody* >(object); 132 assert(body); 133 133 134 134 dynamicsWorld->removeRigidBody(body); … … 143 143 btVector3 localInertia(0,0,0); 144 144 btCollisionShape* shape = reinterpret_cast<btCollisionShape*>( cshape); 145 btAssert(shape);145 assert(shape); 146 146 if (mass) 147 147 { … … 159 159 { 160 160 btRigidBody* body = reinterpret_cast< btRigidBody* >(cbody); 161 btAssert(body);161 assert(body); 162 162 btAlignedFree( body); 163 163 } … … 263 263 { 264 264 btCollisionShape* shape = reinterpret_cast<btCollisionShape*>( cshape); 265 btAssert(shape);265 assert(shape); 266 266 btAlignedFree(shape); 267 267 } … … 269 269 { 270 270 btCollisionShape* shape = reinterpret_cast<btCollisionShape*>( cshape); 271 btAssert(shape);271 assert(shape); 272 272 btVector3 scaling(cscaling[0],cscaling[1],cscaling[2]); 273 273 shape->setLocalScaling(scaling); -
code/branches/questsystem5/src/bullet/BulletDynamics/Dynamics/btContinuousDynamicsWorld.cpp
r2907 r2908 91 91 92 92 ///update vehicle simulation 93 updateActions(timeStep); 93 updateVehicles(timeStep); 94 94 95 95 96 updateActivationState( timeStep ); -
code/branches/questsystem5/src/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp
r2907 r2908 30 30 #include "BulletDynamics/ConstraintSolver/btContactSolverInfo.h" 31 31 #include "BulletDynamics/ConstraintSolver/btTypedConstraint.h" 32 #include "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h"33 #include "BulletDynamics/ConstraintSolver/btHingeConstraint.h"34 #include "BulletDynamics/ConstraintSolver/btConeTwistConstraint.h"35 #include "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h"36 #include "BulletDynamics/ConstraintSolver/btSliderConstraint.h"37 32 38 33 //for debug rendering … … 52 47 53 48 54 #include "BulletDynamics/Dynamics/btActionInterface.h" 49 50 //vehicle 51 #include "BulletDynamics/Vehicle/btRaycastVehicle.h" 52 #include "BulletDynamics/Vehicle/btVehicleRaycaster.h" 53 #include "BulletDynamics/Vehicle/btWheelInfo.h" 54 //character 55 #include "BulletDynamics/Character/btCharacterControllerInterface.h" 56 57 #include "LinearMath/btIDebugDraw.h" 55 58 #include "LinearMath/btQuickprof.h" 56 59 #include "LinearMath/btMotionState.h" … … 111 114 if (body) 112 115 { 116 btTransform predictedTrans; 113 117 if (body->getActivationState() != ISLAND_SLEEPING) 114 118 { … … 145 149 } 146 150 } 147 bool drawConstraints = false;148 if (getDebugDrawer())149 {150 int mode = getDebugDrawer()->getDebugMode();151 if(mode & (btIDebugDraw::DBG_DrawConstraints | btIDebugDraw::DBG_DrawConstraintLimits))152 {153 drawConstraints = true;154 }155 }156 if(drawConstraints)157 {158 for(int i = getNumConstraints()-1; i>=0 ;i--)159 {160 btTypedConstraint* constraint = getConstraint(i);161 debugDrawConstraint(constraint);162 }163 }164 165 151 166 152 … … 205 191 } 206 192 207 if (getDebugDrawer() && getDebugDrawer()->getDebugMode()) 208 { 209 for (i=0;i<m_actions.size();i++) 210 { 211 m_actions[i]->debugDraw(m_debugDrawer); 193 for ( i=0;i<this->m_vehicles.size();i++) 194 { 195 for (int v=0;v<m_vehicles[i]->getNumWheels();v++) 196 { 197 btVector3 wheelColor(0,255,255); 198 if (m_vehicles[i]->getWheelInfo(v).m_raycastInfo.m_isInContact) 199 { 200 wheelColor.setValue(0,0,255); 201 } else 202 { 203 wheelColor.setValue(255,0,255); 204 } 205 206 btVector3 wheelPosWS = m_vehicles[i]->getWheelInfo(v).m_worldTransform.getOrigin(); 207 208 btVector3 axle = btVector3( 209 m_vehicles[i]->getWheelInfo(v).m_worldTransform.getBasis()[0][m_vehicles[i]->getRightAxis()], 210 m_vehicles[i]->getWheelInfo(v).m_worldTransform.getBasis()[1][m_vehicles[i]->getRightAxis()], 211 m_vehicles[i]->getWheelInfo(v).m_worldTransform.getBasis()[2][m_vehicles[i]->getRightAxis()]); 212 213 214 //m_vehicles[i]->getWheelInfo(v).m_raycastInfo.m_wheelAxleWS 215 //debug wheels (cylinders) 216 m_debugDrawer->drawLine(wheelPosWS,wheelPosWS+axle,wheelColor); 217 m_debugDrawer->drawLine(wheelPosWS,m_vehicles[i]->getWheelInfo(v).m_raycastInfo.m_contactPointWS,wheelColor); 218 212 219 } 213 220 } … … 281 288 } 282 289 } 283 /* 290 284 291 if (getDebugDrawer() && getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawWireframe) 285 292 { … … 293 300 } 294 301 } 295 */296 297 302 298 303 } … … 335 340 if (getDebugDrawer()) 336 341 { 337 btIDebugDraw* debugDrawer = getDebugDrawer (); 338 gDisableDeactivation = (debugDrawer->getDebugMode() & btIDebugDraw::DBG_NoDeactivation) != 0; 342 gDisableDeactivation = (getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_NoDeactivation) != 0; 339 343 } 340 344 if (numSimulationSubSteps) … … 400 404 401 405 ///update vehicle simulation 402 updateActions(timeStep); 403 406 updateVehicles(timeStep); 407 408 updateCharacters(timeStep); 409 404 410 updateActivationState( timeStep ); 405 411 … … 465 471 466 472 467 void btDiscreteDynamicsWorld::updateActions(btScalar timeStep) 468 { 469 BT_PROFILE("updateActions"); 470 471 for ( int i=0;i<m_actions.size();i++) 472 { 473 m_actions[i]->updateAction( this, timeStep); 474 } 475 } 473 void btDiscreteDynamicsWorld::updateVehicles(btScalar timeStep) 474 { 475 BT_PROFILE("updateVehicles"); 476 477 for ( int i=0;i<m_vehicles.size();i++) 478 { 479 btRaycastVehicle* vehicle = m_vehicles[i]; 480 vehicle->updateVehicle( timeStep); 481 } 482 } 483 484 void btDiscreteDynamicsWorld::updateCharacters(btScalar timeStep) 485 { 486 BT_PROFILE("updateCharacters"); 487 488 for ( int i=0;i<m_characters.size();i++) 489 { 490 btCharacterControllerInterface* character = m_characters[i]; 491 character->preStep (this); 492 character->playerStep (this,timeStep); 493 } 494 } 495 476 496 477 497 … … 530 550 } 531 551 532 void btDiscreteDynamicsWorld::addAction(btActionInterface* action) 533 { 534 m_actions.push_back(action); 535 } 536 537 void btDiscreteDynamicsWorld::removeAction(btActionInterface* action) 538 { 539 m_actions.remove(action); 540 } 541 542 543 void btDiscreteDynamicsWorld::addVehicle(btActionInterface* vehicle) 544 { 545 addAction(vehicle); 546 } 547 548 void btDiscreteDynamicsWorld::removeVehicle(btActionInterface* vehicle) 549 { 550 removeAction(vehicle); 551 } 552 553 void btDiscreteDynamicsWorld::addCharacter(btActionInterface* character) 554 { 555 addAction(character); 556 } 557 558 void btDiscreteDynamicsWorld::removeCharacter(btActionInterface* character) 559 { 560 removeAction(character); 552 void btDiscreteDynamicsWorld::addVehicle(btRaycastVehicle* vehicle) 553 { 554 m_vehicles.push_back(vehicle); 555 } 556 557 void btDiscreteDynamicsWorld::removeVehicle(btRaycastVehicle* vehicle) 558 { 559 m_vehicles.remove(vehicle); 560 } 561 562 void btDiscreteDynamicsWorld::addCharacter(btCharacterControllerInterface* character) 563 { 564 m_characters.push_back(character); 565 } 566 567 void btDiscreteDynamicsWorld::removeCharacter(btCharacterControllerInterface* character) 568 { 569 m_characters.remove(character); 561 570 } 562 571 … … 634 643 if (islandId<0) 635 644 { 636 if (numManifolds + m_numConstraints) 637 { 638 ///we don't split islands, so all constraints/contact manifolds/bodies are passed into the solver regardless the island id 639 m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,&m_sortedConstraints[0],m_numConstraints,m_solverInfo,m_debugDrawer,m_stackAlloc,m_dispatcher); 640 } 645 ///we don't split islands, so all constraints/contact manifolds/bodies are passed into the solver regardless the island id 646 m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,&m_sortedConstraints[0],m_numConstraints,m_solverInfo,m_debugDrawer,m_stackAlloc,m_dispatcher); 641 647 } else 642 648 { … … 684 690 } 685 691 686 // btAssert(0);692 // assert(0); 687 693 688 694 … … 748 754 btScalar m_allowedPenetration; 749 755 btOverlappingPairCache* m_pairCache; 750 btDispatcher* m_dispatcher;751 756 752 757 753 758 public: 754 btClosestNotMeConvexResultCallback (btCollisionObject* me,const btVector3& fromA,const btVector3& toA,btOverlappingPairCache* pairCache ,btDispatcher* dispatcher) :759 btClosestNotMeConvexResultCallback (btCollisionObject* me,const btVector3& fromA,const btVector3& toA,btOverlappingPairCache* pairCache) : 755 760 btCollisionWorld::ClosestConvexResultCallback(fromA,toA), 756 761 m_allowedPenetration(0.0f), 757 762 m_me(me), 758 m_pairCache(pairCache), 759 m_dispatcher(dispatcher) 763 m_pairCache(pairCache) 760 764 { 761 765 } … … 792 796 return false; 793 797 794 btCollisionObject* otherObj = (btCollisionObject*) proxy0->m_clientObject; 795 796 //call needsResponse, see http://code.google.com/p/bullet/issues/detail?id=179 797 if (m_dispatcher->needsResponse(m_me,otherObj)) 798 { 799 ///don't do CCD when there are already contact points (touching contact/penetration) 800 btAlignedObjectArray<btPersistentManifold*> manifoldArray; 801 btBroadphasePair* collisionPair = m_pairCache->findPair(m_me->getBroadphaseHandle(),proxy0); 802 if (collisionPair) 803 { 804 if (collisionPair->m_algorithm) 805 { 806 manifoldArray.resize(0); 807 collisionPair->m_algorithm->getAllContactManifolds(manifoldArray); 808 for (int j=0;j<manifoldArray.size();j++) 809 { 810 btPersistentManifold* manifold = manifoldArray[j]; 811 if (manifold->getNumContacts()>0) 812 return false; 813 } 798 ///don't do CCD when there are already contact points (touching contact/penetration) 799 btAlignedObjectArray<btPersistentManifold*> manifoldArray; 800 btBroadphasePair* collisionPair = m_pairCache->findPair(m_me->getBroadphaseHandle(),proxy0); 801 if (collisionPair) 802 { 803 if (collisionPair->m_algorithm) 804 { 805 manifoldArray.resize(0); 806 collisionPair->m_algorithm->getAllContactManifolds(manifoldArray); 807 for (int j=0;j<manifoldArray.size();j++) 808 { 809 btPersistentManifold* manifold = manifoldArray[j]; 810 if (manifold->getNumContacts()>0) 811 return false; 814 812 } 815 813 } … … 849 847 gNumClampedCcdMotions++; 850 848 851 btClosestNotMeConvexResultCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache() ,getDispatcher());849 btClosestNotMeConvexResultCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache()); 852 850 btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape()); 853 851 btSphereShape tmpSphere(body->getCcdSweptSphereRadius());//btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape()); … … 1190 1188 1191 1189 1192 void btDiscreteDynamicsWorld::debugDrawConstraint(btTypedConstraint* constraint)1193 {1194 bool drawFrames = (getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawConstraints) != 0;1195 bool drawLimits = (getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawConstraintLimits) != 0;1196 btScalar dbgDrawSize = constraint->getDbgDrawSize();1197 if(dbgDrawSize <= btScalar(0.f))1198 {1199 return;1200 }1201 1202 switch(constraint->getConstraintType())1203 {1204 case POINT2POINT_CONSTRAINT_TYPE:1205 {1206 btPoint2PointConstraint* p2pC = (btPoint2PointConstraint*)constraint;1207 btTransform tr;1208 tr.setIdentity();1209 btVector3 pivot = p2pC->getPivotInA();1210 pivot = p2pC->getRigidBodyA().getCenterOfMassTransform() * pivot;1211 tr.setOrigin(pivot);1212 getDebugDrawer()->drawTransform(tr, dbgDrawSize);1213 // that ideally should draw the same frame1214 pivot = p2pC->getPivotInB();1215 pivot = p2pC->getRigidBodyB().getCenterOfMassTransform() * pivot;1216 tr.setOrigin(pivot);1217 if(drawFrames) getDebugDrawer()->drawTransform(tr, dbgDrawSize);1218 }1219 break;1220 case HINGE_CONSTRAINT_TYPE:1221 {1222 btHingeConstraint* pHinge = (btHingeConstraint*)constraint;1223 btTransform tr = pHinge->getRigidBodyA().getCenterOfMassTransform() * pHinge->getAFrame();1224 if(drawFrames) getDebugDrawer()->drawTransform(tr, dbgDrawSize);1225 tr = pHinge->getRigidBodyB().getCenterOfMassTransform() * pHinge->getBFrame();1226 if(drawFrames) getDebugDrawer()->drawTransform(tr, dbgDrawSize);1227 btScalar minAng = pHinge->getLowerLimit();1228 btScalar maxAng = pHinge->getUpperLimit();1229 if(minAng == maxAng)1230 {1231 break;1232 }1233 bool drawSect = true;1234 if(minAng > maxAng)1235 {1236 minAng = btScalar(0.f);1237 maxAng = SIMD_2_PI;1238 drawSect = false;1239 }1240 if(drawLimits)1241 {1242 btVector3& center = tr.getOrigin();1243 btVector3 normal = tr.getBasis().getColumn(2);1244 btVector3 axis = tr.getBasis().getColumn(0);1245 getDebugDrawer()->drawArc(center, normal, axis, dbgDrawSize, dbgDrawSize, minAng, maxAng, btVector3(0,0,0), drawSect);1246 }1247 }1248 break;1249 case CONETWIST_CONSTRAINT_TYPE:1250 {1251 btConeTwistConstraint* pCT = (btConeTwistConstraint*)constraint;1252 btTransform tr = pCT->getRigidBodyA().getCenterOfMassTransform() * pCT->getAFrame();1253 if(drawFrames) getDebugDrawer()->drawTransform(tr, dbgDrawSize);1254 tr = pCT->getRigidBodyB().getCenterOfMassTransform() * pCT->getBFrame();1255 if(drawFrames) getDebugDrawer()->drawTransform(tr, dbgDrawSize);1256 if(drawLimits)1257 {1258 //const btScalar length = btScalar(5);1259 const btScalar length = dbgDrawSize;1260 static int nSegments = 8*4;1261 btScalar fAngleInRadians = btScalar(2.*3.1415926) * (btScalar)(nSegments-1)/btScalar(nSegments);1262 btVector3 pPrev = pCT->GetPointForAngle(fAngleInRadians, length);1263 pPrev = tr * pPrev;1264 for (int i=0; i<nSegments; i++)1265 {1266 fAngleInRadians = btScalar(2.*3.1415926) * (btScalar)i/btScalar(nSegments);1267 btVector3 pCur = pCT->GetPointForAngle(fAngleInRadians, length);1268 pCur = tr * pCur;1269 getDebugDrawer()->drawLine(pPrev, pCur, btVector3(0,0,0));1270 1271 if (i%(nSegments/8) == 0)1272 getDebugDrawer()->drawLine(tr.getOrigin(), pCur, btVector3(0,0,0));1273 1274 pPrev = pCur;1275 }1276 btScalar tws = pCT->getTwistSpan();1277 btScalar twa = pCT->getTwistAngle();1278 bool useFrameB = (pCT->getRigidBodyB().getInvMass() > btScalar(0.f));1279 if(useFrameB)1280 {1281 tr = pCT->getRigidBodyB().getCenterOfMassTransform() * pCT->getBFrame();1282 }1283 else1284 {1285 tr = pCT->getRigidBodyA().getCenterOfMassTransform() * pCT->getAFrame();1286 }1287 btVector3 pivot = tr.getOrigin();1288 btVector3 normal = tr.getBasis().getColumn(0);1289 btVector3 axis1 = tr.getBasis().getColumn(1);1290 getDebugDrawer()->drawArc(pivot, normal, axis1, dbgDrawSize, dbgDrawSize, -twa-tws, -twa+tws, btVector3(0,0,0), true);1291 1292 }1293 }1294 break;1295 case D6_CONSTRAINT_TYPE:1296 {1297 btGeneric6DofConstraint* p6DOF = (btGeneric6DofConstraint*)constraint;1298 btTransform tr = p6DOF->getCalculatedTransformA();1299 if(drawFrames) getDebugDrawer()->drawTransform(tr, dbgDrawSize);1300 tr = p6DOF->getCalculatedTransformB();1301 if(drawFrames) getDebugDrawer()->drawTransform(tr, dbgDrawSize);1302 if(drawLimits)1303 {1304 tr = p6DOF->getCalculatedTransformA();1305 const btVector3& center = p6DOF->getCalculatedTransformB().getOrigin();1306 btVector3 up = tr.getBasis().getColumn(2);1307 btVector3 axis = tr.getBasis().getColumn(0);1308 btScalar minTh = p6DOF->getRotationalLimitMotor(1)->m_loLimit;1309 btScalar maxTh = p6DOF->getRotationalLimitMotor(1)->m_hiLimit;1310 btScalar minPs = p6DOF->getRotationalLimitMotor(2)->m_loLimit;1311 btScalar maxPs = p6DOF->getRotationalLimitMotor(2)->m_hiLimit;1312 getDebugDrawer()->drawSpherePatch(center, up, axis, dbgDrawSize * btScalar(.9f), minTh, maxTh, minPs, maxPs, btVector3(0,0,0));1313 axis = tr.getBasis().getColumn(1);1314 btScalar ay = p6DOF->getAngle(1);1315 btScalar az = p6DOF->getAngle(2);1316 btScalar cy = btCos(ay);1317 btScalar sy = btSin(ay);1318 btScalar cz = btCos(az);1319 btScalar sz = btSin(az);1320 btVector3 ref;1321 ref[0] = cy*cz*axis[0] + cy*sz*axis[1] - sy*axis[2];1322 ref[1] = -sz*axis[0] + cz*axis[1];1323 ref[2] = cz*sy*axis[0] + sz*sy*axis[1] + cy*axis[2];1324 tr = p6DOF->getCalculatedTransformB();1325 btVector3 normal = -tr.getBasis().getColumn(0);1326 btScalar minFi = p6DOF->getRotationalLimitMotor(0)->m_loLimit;1327 btScalar maxFi = p6DOF->getRotationalLimitMotor(0)->m_hiLimit;1328 if(minFi > maxFi)1329 {1330 getDebugDrawer()->drawArc(center, normal, ref, dbgDrawSize, dbgDrawSize, -SIMD_PI, SIMD_PI, btVector3(0,0,0), false);1331 }1332 else if(minFi < maxFi)1333 {1334 getDebugDrawer()->drawArc(center, normal, ref, dbgDrawSize, dbgDrawSize, minFi, maxFi, btVector3(0,0,0), true);1335 }1336 tr = p6DOF->getCalculatedTransformA();1337 btVector3 bbMin = p6DOF->getTranslationalLimitMotor()->m_lowerLimit;1338 btVector3 bbMax = p6DOF->getTranslationalLimitMotor()->m_upperLimit;1339 getDebugDrawer()->drawBox(bbMin, bbMax, tr, btVector3(0,0,0));1340 }1341 }1342 break;1343 case SLIDER_CONSTRAINT_TYPE:1344 {1345 btSliderConstraint* pSlider = (btSliderConstraint*)constraint;1346 btTransform tr = pSlider->getCalculatedTransformA();1347 if(drawFrames) getDebugDrawer()->drawTransform(tr, dbgDrawSize);1348 tr = pSlider->getCalculatedTransformB();1349 if(drawFrames) getDebugDrawer()->drawTransform(tr, dbgDrawSize);1350 if(drawLimits)1351 {1352 btTransform tr = pSlider->getCalculatedTransformA();1353 btVector3 li_min = tr * btVector3(pSlider->getLowerLinLimit(), 0.f, 0.f);1354 btVector3 li_max = tr * btVector3(pSlider->getUpperLinLimit(), 0.f, 0.f);1355 getDebugDrawer()->drawLine(li_min, li_max, btVector3(0, 0, 0));1356 btVector3 normal = tr.getBasis().getColumn(0);1357 btVector3 axis = tr.getBasis().getColumn(1);1358 btScalar a_min = pSlider->getLowerAngLimit();1359 btScalar a_max = pSlider->getUpperAngLimit();1360 const btVector3& center = pSlider->getCalculatedTransformB().getOrigin();1361 getDebugDrawer()->drawArc(center, normal, axis, dbgDrawSize, dbgDrawSize, a_min, a_max, btVector3(0,0,0), true);1362 }1363 }1364 break;1365 default :1366 break;1367 }1368 return;1369 } // btDiscreteDynamicsWorld::debugDrawConstraint()1370 1371 1372 1373 1374 1375 1190 void btDiscreteDynamicsWorld::setConstraintSolver(btConstraintSolver* solver) 1376 1191 { … … 1401 1216 return m_constraints[index]; 1402 1217 } 1403 1404 -
code/branches/questsystem5/src/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h
r2907 r2908 24 24 class btSimulationIslandManager; 25 25 class btTypedConstraint; 26 class btActionInterface;27 26 27 28 class btRaycastVehicle; 29 class btCharacterControllerInterface; 28 30 class btIDebugDraw; 29 31 #include "LinearMath/btAlignedObjectArray.h" … … 51 53 bool m_ownsConstraintSolver; 52 54 53 btAlignedObjectArray<btActionInterface*> m_actions;54 55 56 btAlignedObjectArray<btRaycastVehicle*> m_vehicles; 57 58 btAlignedObjectArray<btCharacterControllerInterface*> m_characters; 59 60 55 61 int m_profileTimings; 56 62 … … 65 71 void updateActivationState(btScalar timeStep); 66 72 67 void updateActions(btScalar timeStep); 73 void updateVehicles(btScalar timeStep); 74 75 void updateCharacters(btScalar timeStep); 68 76 69 77 void startProfiling(btScalar timeStep); … … 98 106 virtual void removeConstraint(btTypedConstraint* constraint); 99 107 100 virtual void add Action(btActionInterface*);108 virtual void addVehicle(btRaycastVehicle* vehicle); 101 109 102 virtual void remove Action(btActionInterface*);110 virtual void removeVehicle(btRaycastVehicle* vehicle); 103 111 112 virtual void addCharacter(btCharacterControllerInterface* character); 113 114 virtual void removeCharacter(btCharacterControllerInterface* character); 115 116 104 117 btSimulationIslandManager* getSimulationIslandManager() 105 118 { … … 118 131 119 132 virtual void setGravity(const btVector3& gravity); 120 121 133 virtual btVector3 getGravity () const; 122 134 … … 128 140 129 141 void debugDrawObject(const btTransform& worldTransform, const btCollisionShape* shape, const btVector3& color); 130 131 void debugDrawConstraint(btTypedConstraint* constraint);132 142 133 143 virtual void debugDrawWorld(); … … 160 170 } 161 171 162 ///obsolete, use updateActions instead163 virtual void updateVehicles(btScalar timeStep)164 {165 updateActions(timeStep);166 }167 168 ///obsolete, use addAction instead169 virtual void addVehicle(btActionInterface* vehicle);170 ///obsolete, use removeAction instead171 virtual void removeVehicle(btActionInterface* vehicle);172 ///obsolete, use addAction instead173 virtual void addCharacter(btActionInterface* character);174 ///obsolete, use removeAction instead175 virtual void removeCharacter(btActionInterface* character);176 177 172 }; 178 173 -
code/branches/questsystem5/src/bullet/BulletDynamics/Dynamics/btDynamicsWorld.h
r2907 r2908 21 21 22 22 class btTypedConstraint; 23 class bt ActionInterface;23 class btRaycastVehicle; 24 24 class btConstraintSolver; 25 25 class btDynamicsWorld; 26 26 class btCharacterControllerInterface; 27 27 28 28 /// Type for the callback for each tick … … 73 73 virtual void removeConstraint(btTypedConstraint* constraint) {(void)constraint;} 74 74 75 virtual void add Action(btActionInterface* action) = 0;75 virtual void addVehicle(btRaycastVehicle* vehicle) {(void)vehicle;} 76 76 77 virtual void removeAction(btActionInterface* action) = 0; 77 virtual void removeVehicle(btRaycastVehicle* vehicle) {(void)vehicle;} 78 79 virtual void addCharacter(btCharacterControllerInterface* character) {(void)character;} 80 81 virtual void removeCharacter(btCharacterControllerInterface* character) {(void)character;} 82 78 83 79 84 //once a rigidbody is added to the dynamics world, it will get this gravity assigned … … 125 130 126 131 127 ///obsolete, use addAction instead.128 virtual void addVehicle(btActionInterface* vehicle) {(void)vehicle;}129 ///obsolete, use removeAction instead130 virtual void removeVehicle(btActionInterface* vehicle) {(void)vehicle;}131 ///obsolete, use addAction instead.132 virtual void addCharacter(btActionInterface* character) {(void)character;}133 ///obsolete, use removeAction instead134 virtual void removeCharacter(btActionInterface* character) {(void)character;}135 136 137 132 }; 138 133 -
code/branches/questsystem5/src/bullet/BulletDynamics/Dynamics/btRigidBody.cpp
r2907 r2908 47 47 m_angularFactor = btScalar(1.); 48 48 m_gravity.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0)); 49 m_gravity_acceleration.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0));50 49 m_totalForce.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0)); 51 50 m_totalTorque.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0)), … … 126 125 m_gravity = acceleration * (btScalar(1.0) / m_inverseMass); 127 126 } 128 m_gravity_acceleration = acceleration;129 127 } 130 128 -
code/branches/questsystem5/src/bullet/BulletDynamics/Dynamics/btRigidBody.h
r2907 r2908 49 49 50 50 btVector3 m_gravity; 51 btVector3 m_gravity_acceleration;52 51 btVector3 m_invInertiaLocal; 53 52 btVector3 m_totalForce; … … 183 182 const btVector3& getGravity() const 184 183 { 185 return m_gravity _acceleration;184 return m_gravity; 186 185 } 187 186 … … 233 232 m_totalForce += force; 234 233 } 235 236 const btVector3& getTotalForce()237 {238 return m_totalForce;239 };240 241 const btVector3& getTotalTorque()242 {243 return m_totalTorque;244 };245 234 246 const btVector3& getInvInertiaDiagLocal() const235 const btVector3& getInvInertiaDiagLocal() 247 236 { 248 237 return m_invInertiaLocal;
Note: See TracChangeset
for help on using the changeset viewer.