From 5fd1a69f32cd6e223cb6589c826ccfc832d56138 Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Thu, 28 Aug 2008 02:01:23 +0000 Subject: [PATCH] Added some comments for stepSimulation and fixed bug: uninitialized variable m_shapeDrawer(drawer) in DebugCastResult.h --- Demos/OpenGL/DebugCastResult.h | 6 ++++-- src/BulletDynamics/Dynamics/btDynamicsWorld.h | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Demos/OpenGL/DebugCastResult.h b/Demos/OpenGL/DebugCastResult.h index 65adbfe61..ef3befe44 100644 --- a/Demos/OpenGL/DebugCastResult.h +++ b/Demos/OpenGL/DebugCastResult.h @@ -44,7 +44,8 @@ struct btDebugCastResult : public btConvexCast::CastResult :m_fromTrans(fromTrans), m_shape(shape), m_linVel(linVel), - m_angVel(angVel) + m_angVel(angVel), + m_shapeDrawer(drawer) { } @@ -78,7 +79,8 @@ struct btDebugCastResult : public btConvexCast::CastResult btTransform hitTrans; btTransformUtil::integrateTransform(m_fromTrans,m_linVel,m_angVel,fraction,hitTrans); hitTrans.getOpenGLMatrix(m); - m_shapeDrawer->drawOpenGL(m,m_shape,btVector3(1,0,0),btIDebugDraw::DBG_NoDebug,worldBoundsMin,worldBoundsMax); + if (m_shapeDrawer) + m_shapeDrawer->drawOpenGL(m,m_shape,btVector3(1,0,0),btIDebugDraw::DBG_NoDebug,worldBoundsMin,worldBoundsMax); } }; diff --git a/src/BulletDynamics/Dynamics/btDynamicsWorld.h b/src/BulletDynamics/Dynamics/btDynamicsWorld.h index a7f4ed631..095c61bcc 100644 --- a/src/BulletDynamics/Dynamics/btDynamicsWorld.h +++ b/src/BulletDynamics/Dynamics/btDynamicsWorld.h @@ -34,7 +34,7 @@ enum btDynamicsWorldType BT_CONTINUOUS_DYNAMICS_WORLD=3 }; -///btDynamicsWorld is the baseclass for several dynamics implementation, basic, discrete, parallel, and continuous +///The btDynamicsWorld is the interface class for several dynamics implementation, basic, discrete, parallel, and continuous etc. class btDynamicsWorld : public btCollisionWorld { @@ -56,9 +56,11 @@ public: { } - ///stepSimulation proceeds the simulation over timeStep units - ///if maxSubSteps > 0, it will interpolate time steps - virtual int stepSimulation( btScalar timeStep,int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.))=0; + ///stepSimulation proceeds the simulation over 'timeStep', units in preferably in seconds. + ///By default, Bullet will subdivide the timestep in constant substeps of each 'fixedTimeStep'. + ///in order to keep the simulation real-time, the maximum number of substeps can be clamped to 'maxSubSteps'. + ///You can disable subdividing the timestep/substepping by passing maxSubSteps=0 as second argument to stepSimulation, but in that case you have to keep the timeStep constant. + virtual int stepSimulation( btScalar timeStep,int maxSubSteps=10, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.))=0; virtual void debugDrawWorld() = 0;