Added a very basic dynamics demo, only using spheres (and optionally boxes)

This commit is contained in:
ejcoumans
2006-10-09 20:41:18 +00:00
parent 659207e7a3
commit f3eb3cfa37
12 changed files with 311 additions and 16 deletions

View File

@@ -47,7 +47,7 @@ btSimpleDynamicsWorld::~btSimpleDynamicsWorld()
delete m_constraintSolver;
}
void btSimpleDynamicsWorld::stepSimulation(float timeStep)
void btSimpleDynamicsWorld::stepSimulation(float timeStep,int numSubsteps)
{
///apply gravity, predict motion
predictUnconstraintMotion(timeStep);
@@ -56,12 +56,16 @@ void btSimpleDynamicsWorld::stepSimulation(float timeStep)
performDiscreteCollisionDetection();
///solve contact constraints
btPersistentManifold** manifoldPtr = ((btCollisionDispatcher*)m_dispatcher1)->getInternalManifoldPointer();
int numManifolds = m_dispatcher1->getNumManifolds();
btContactSolverInfo infoGlobal;
infoGlobal.m_timeStep = timeStep;
m_constraintSolver->solveGroup(manifoldPtr, numManifolds,infoGlobal,m_debugDrawer);
if (numManifolds)
{
btPersistentManifold** manifoldPtr = ((btCollisionDispatcher*)m_dispatcher1)->getInternalManifoldPointer();
btContactSolverInfo infoGlobal;
infoGlobal.m_timeStep = timeStep;
m_constraintSolver->solveGroup(manifoldPtr, numManifolds,infoGlobal,m_debugDrawer);
}
///integrate transforms
integrateTransforms(timeStep);

View File

@@ -54,7 +54,7 @@ public:
virtual ~btSimpleDynamicsWorld();
virtual void stepSimulation( float timeStep);
virtual void stepSimulation( float timeStep,int numSubsteps=1);
virtual void setDebugDrawer(btIDebugDraw* debugDrawer)
{