aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs52
1 files changed, 31 insertions, 21 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 5234cd3..a765878 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -787,9 +787,10 @@ namespace OpenSim.Region.Physics.OdePlugin
787 } 787 }
788 } 788 }
789 789
790 public override void Simulate(float timeStep) 790 public override float Simulate(float timeStep)
791 { 791 {
792 792 float fps = 0;
793
793 step_time += timeStep; 794 step_time += timeStep;
794 795
795 796
@@ -800,32 +801,40 @@ namespace OpenSim.Region.Physics.OdePlugin
800 801
801 802
802 803
803 if (step_time >= m_SkipFramesAtms) 804 if (step_time >= m_SkipFramesAtms)
804 { 805 {
805 // Instead of trying to catch up, it'll do one physics frame only 806 // Instead of trying to catch up, it'll do one physics frame only
806 step_time = ODE_STEPSIZE; 807 step_time = ODE_STEPSIZE;
807 this.m_physicsiterations = 5; 808 this.m_physicsiterations = 5;
809 }
810 else
811 {
812 m_physicsiterations = 10;
813 }
814 lock (OdeLock)
815 {
816 // Process 10 frames if the sim is running normal..
817 // process 5 frames if the sim is running slow
818 try{
819 d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
808 } 820 }
809 else 821 catch (System.StackOverflowException)
810 { 822 {
811 m_physicsiterations = 10; 823 MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
824 base.TriggerPhysicsBasedRestart();
812 } 825 }
813 lock (OdeLock)
814 {
815 // Process 10 frames if the sim is running normal..
816 // process 5 frames if the sim is running slow
817 try{
818 d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
819 }
820 catch (System.StackOverflowException)
821 {
822 MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
823 base.TriggerPhysicsBasedRestart();
824 }
825 826
826 int i = 0; 827 int i = 0;
828
829
830 // Figure out the Frames Per Second we're going at.
831
832 fps = (((step_time / ODE_STEPSIZE * m_physicsiterations)*2)* 10);
833
834
827 while (step_time > 0.0f) 835 while (step_time > 0.0f)
828 { 836 {
837
829 foreach (OdeCharacter actor in _characters) 838 foreach (OdeCharacter actor in _characters)
830 { 839 {
831 actor.Move(timeStep); 840 actor.Move(timeStep);
@@ -875,6 +884,7 @@ namespace OpenSim.Region.Physics.OdePlugin
875 } 884 }
876 } 885 }
877 } 886 }
887 return fps;
878 } 888 }
879 889
880 public override void GetResults() 890 public override void GetResults()