Browse Source

Warning if elapsed time < stepsize (no simulation but interpolation!)

enn0x 14 years ago
parent
commit
540f7f2150

+ 1 - 0
panda/src/bullet/bulletCharacterControllerNode.cxx

@@ -229,6 +229,7 @@ sync_p2b(float dt) {
 
   //_character->setVelocityForTimeInterval(v, dt);
   _character->setWalkDirection(v * dt);
+  //_character->setWalkDirection(v);
   _angular_velocity = 0.0f;
 }
 

+ 9 - 1
panda/src/bullet/bulletWorld.cxx

@@ -148,9 +148,17 @@ do_physics(float dt, int substeps, float stepsize) {
 
   // Simulation
   _pstat_simulation.start();
-  _world->stepSimulation(dt, substeps, stepsize);
+  int n = _world->stepSimulation(dt, substeps, stepsize);
   _pstat_simulation.stop();
 
+  if (!n) {
+    bullet_cat.warning() << "interpolated transforms!" << endl;
+  }
+
+  //if (dt > substeps * stepsize) {
+  //  bullet_cat.warning() << "lost simulation time!" << endl;
+  //}
+
   // Synchronize Bullet to Panda
   _pstat_b2p.start();
   sync_b2p();

+ 1 - 1
panda/src/bullet/bulletWorld.h

@@ -56,7 +56,7 @@ PUBLISHED:
   void set_gravity(float gx, float gy, float gz);
   const LVector3f get_gravity() const;
 
-  void do_physics(float dt, int substeps=10, float stepsize=1.0f/60.0f);
+  void do_physics(float dt, int substeps=1, float stepsize=1.0f/60.0f);
 
   void set_debug_node(BulletDebugNode *node);
   void clear_debug_node();