Properly propagate the applied impulse for the MLCP solvers, so it will be available for contact and non-contact constraints.

Use real-time clock in AllBullet2Demos, rather than hard-coded 1./60.
This commit is contained in:
erwin coumans
2014-02-24 13:24:49 -08:00
parent fabdf8b4a9
commit dfa738c13a
7 changed files with 130 additions and 75 deletions

View File

@@ -25,14 +25,15 @@ static BulletDemoEntry allDemos[]=
//{"emptydemo",EmptyBulletDemo::MyCreateFunc},
{"BasicDemo",BasicDemo::MyCreateFunc},
/*
{"ChainDemo",ChainDemo::MyCreateFunc},
{"SIHingeDemo",HingeDemo::SICreateFunc},
{"PGSHingeDemo",HingeDemo::PGSCreateFunc},
{"DantzigHingeDemo",HingeDemo::DantzigCreateFunc},
{"LemkeHingeDemo",HingeDemo::LemkeCreateFunc},
{"InertiaHingeDemo",HingeDemo::InertiaCreateFunc},
{"ABMHingeDemo",HingeDemo::FeatherstoneCreateFunc},
*/
{"Ragdoll",RagDollDemo::MyCreateFunc},
{"MultiBody1",FeatherstoneDemo1::MyCreateFunc},

View File

@@ -5,7 +5,7 @@
#include "../GpuDemos/gwenUserInterface.h"
#include "BulletDemoEntries.h"
#include "../../btgui/Timing/b3Clock.h"
#define DEMO_SELECTION_COMBOBOX 13
const char* startFileName = "bulletDemo.txt";
static SimpleOpenGL3App* app=0;
@@ -132,7 +132,8 @@ void MyComboBoxCallback(int comboId, const char* item)
int main(int argc, char* argv[])
{
b3Clock clock;
float dt = 1./120.f;
int width = 1024;
int height=768;
@@ -167,6 +168,7 @@ int main(int argc, char* argv[])
gui->setComboBoxCallback(MyComboBoxCallback);
unsigned long int prevTimeInMicroseconds = clock.getTimeMicroseconds();
do
{
@@ -191,7 +193,13 @@ int main(int argc, char* argv[])
if (sCurrentDemo)
{
if (!pauseSimulation)
sCurrentDemo->stepSimulation(1./60.f);
{
unsigned long int curTimeInMicroseconds = clock.getTimeMicroseconds();
unsigned long int diff = curTimeInMicroseconds-prevTimeInMicroseconds;
float deltaTimeInSeconds = (diff)*1.e-6;
sCurrentDemo->stepSimulation(deltaTimeInSeconds);//1./60.f);
prevTimeInMicroseconds = curTimeInMicroseconds;
}
sCurrentDemo->renderScene();
}