add single step simulation, using 'o' key. use 'i' key to suspend simulation first
default background color a bit darker, to show debug lines tweaked contact point rendering a bit
This commit is contained in:
@@ -123,6 +123,7 @@ static bool enable_experimental_opencl = false;
|
||||
|
||||
int gDebugDrawFlags = 0;
|
||||
static bool pauseSimulation=false;
|
||||
static bool singleStepSimulation = false;
|
||||
int midiBaseIndex = 176;
|
||||
extern bool gDisableDeactivation;
|
||||
|
||||
@@ -227,6 +228,12 @@ void MyKeyboardCallback(int key, int state)
|
||||
{
|
||||
pauseSimulation = !pauseSimulation;
|
||||
}
|
||||
if (key == 'o' && state)
|
||||
{
|
||||
singleStepSimulation = true;
|
||||
}
|
||||
|
||||
|
||||
#ifndef NO_OPENGL3
|
||||
if (key=='s' && state)
|
||||
{
|
||||
@@ -1124,12 +1131,12 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
||||
|
||||
if (sCurrentDemo)
|
||||
{
|
||||
if (!pauseSimulation)
|
||||
if (!pauseSimulation || singleStepSimulation)
|
||||
{
|
||||
singleStepSimulation = false;
|
||||
//printf("---------------------------------------------------\n");
|
||||
//printf("Framecount = %d\n",frameCount);
|
||||
|
||||
|
||||
|
||||
if (gFixedTimeStep>0)
|
||||
{
|
||||
sCurrentDemo->stepSimulation(gFixedTimeStep);
|
||||
|
||||
@@ -84,7 +84,10 @@ public:
|
||||
|
||||
virtual void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color)
|
||||
{
|
||||
drawLine(PointOnB,PointOnB+normalOnB,color);
|
||||
drawLine(PointOnB,PointOnB+normalOnB*distance,color);
|
||||
btVector3 red(0.3, 1., 0.3);
|
||||
drawLine(PointOnB, PointOnB + normalOnB*0.01, red);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user