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.cs22
1 files changed, 18 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index ec7d04d..7193886 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -32,6 +32,7 @@ using Axiom.Math;
32using Ode.NET; 32using Ode.NET;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.Physics.Manager;
35
35//using OpenSim.Region.Physics.OdePlugin.Meshing; 36//using OpenSim.Region.Physics.OdePlugin.Meshing;
36 37
37namespace OpenSim.Region.Physics.OdePlugin 38namespace OpenSim.Region.Physics.OdePlugin
@@ -234,9 +235,16 @@ namespace OpenSim.Region.Physics.OdePlugin
234 //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); 235 //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2);
235 } 236 }
236 237
237 int count; 238 int count = 0;
238 239 try
240 {
239 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); 241 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf);
242 }
243 catch (System.Runtime.InteropServices.SEHException)
244 {
245 OpenSim.Framework.Console.MainLog.Instance.Error("PHYSICS", "The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim.");
246 base.TriggerPhysicsBasedRestart();
247 }
240 248
241 for (int i = 0; i < count; i++) 249 for (int i = 0; i < count; i++)
242 { 250 {
@@ -805,8 +813,14 @@ namespace OpenSim.Region.Physics.OdePlugin
805 { 813 {
806 // Process 10 frames if the sim is running normal.. 814 // Process 10 frames if the sim is running normal..
807 // process 5 frames if the sim is running slow 815 // process 5 frames if the sim is running slow
808 d.WorldSetQuickStepNumIterations(world, m_physicsiterations); 816 try{
809 817 d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
818 }
819 catch (System.StackOverflowException)
820 {
821 OpenSim.Framework.Console.MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
822 base.TriggerPhysicsBasedRestart();
823 }
810 824
811 int i = 0; 825 int i = 0;
812 while (step_time > 0.0f) 826 while (step_time > 0.0f)