aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2012-08-14 16:20:07 -0700
committerRobert Adams2012-08-15 12:07:49 -0700
commit11a4b9ec1d4f93cfd0600d090efbf257c9ea9a1b (patch)
tree70d31a1036255d05231644d0d9f2a19f1d045545 /OpenSim/Region/Physics
parentLet the temp attachment module add a command to allow attaching without permi... (diff)
downloadopensim-SC_OLD-11a4b9ec1d4f93cfd0600d090efbf257c9ea9a1b.zip
opensim-SC_OLD-11a4b9ec1d4f93cfd0600d090efbf257c9ea9a1b.tar.gz
opensim-SC_OLD-11a4b9ec1d4f93cfd0600d090efbf257c9ea9a1b.tar.bz2
opensim-SC_OLD-11a4b9ec1d4f93cfd0600d090efbf257c9ea9a1b.tar.xz
BulletSim: rework physics FPS calculation to make a more realistic number.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index beaea1f..f63ad95 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -413,7 +413,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
413 // prevent simulation until we've been initialized 413 // prevent simulation until we've been initialized
414 if (!m_initialized) return 10.0f; 414 if (!m_initialized) return 10.0f;
415 415
416 long simulateStartTime = Util.EnvironmentTickCount(); 416 int simulateStartTime = Util.EnvironmentTickCount();
417 417
418 // update the prim states while we know the physics engine is not busy 418 // update the prim states while we know the physics engine is not busy
419 ProcessTaints(); 419 ProcessTaints();
@@ -511,8 +511,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
511 // long simulateTotalTime = Util.EnvironmentTickCountSubtract(simulateStartTime); 511 // long simulateTotalTime = Util.EnvironmentTickCountSubtract(simulateStartTime);
512 // return (timeStep * (float)simulateTotalTime); 512 // return (timeStep * (float)simulateTotalTime);
513 513
514 // TODO: FIX THIS: fps calculation wrong. This calculation always returns about 1 in normal operation. 514 // TODO: FIX THIS: fps calculation possibly wrong.
515 return timeStep / (numSubSteps * m_fixedTimeStep) * 1000f; 515 // This calculation says 1/timeStep is the ideal frame rate. Any time added to
516 // that by the physics simulation gives a slower frame rate.
517 long totalSimulationTime = Util.EnvironmentTickCountSubtract(simulateStartTime);
518 if (totalSimulationTime >= timeStep)
519 return 0;
520 return 1f / (timeStep + totalSimulationTime);
516 } 521 }
517 522
518 // Something has collided 523 // Something has collided