aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-13 07:50:15 +0000
committerTeravus Ovares2008-02-13 07:50:15 +0000
commitd773ca514726d67d7f8092440484f27440459745 (patch)
tree9af8e68eb67c144735e7f773292df45c368218bd /OpenSim/Region
parentClean up more unnecessary String.Format calls (diff)
downloadopensim-SC_OLD-d773ca514726d67d7f8092440484f27440459745.zip
opensim-SC_OLD-d773ca514726d67d7f8092440484f27440459745.tar.gz
opensim-SC_OLD-d773ca514726d67d7f8092440484f27440459745.tar.bz2
opensim-SC_OLD-d773ca514726d67d7f8092440484f27440459745.tar.xz
* Made physical prim stable enough for the general population to turn on. (though I still don't recommend it for welcome regions unless object build is off.
* Updated the ode.dll for windows with a more reasonable stack space reserve. Linux users will need to type ulimit -s 262144 before starting up OpenSimulator if using Physical Prim to protect against stack collisions. or run the included ./bin/opensim-ode.sh to start up OpenSimulator in ODE mode. * Added internal collision score and am keeping track of 'high usage' prim. * Tweaked collisions some more * Tested up to 460 physical prim in extremely close quarters (which was previously impossible in OpenSim). After 460 in tight quarters, physics slows down enough to make it hard to do any moving, however.. non physics things still work, such as logging on to the simulator, etc.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs18
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs5
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs5
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs8
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs48
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs83
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPlugin.cs10
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs10
10 files changed, 176 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index c41979c..dbb4be0 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -737,7 +737,7 @@ namespace OpenSim.Region.Environment.Scenes
737 m_statsReporter.addOtherMS(otherMS); 737 m_statsReporter.addOtherMS(otherMS);
738 m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts()); 738 m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts());
739 m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS()); 739 m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS());
740 740 m_log.Warn(physicsMS);
741 } 741 }
742 catch (NotImplementedException) 742 catch (NotImplementedException)
743 { 743 {
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 5403fc7..61fce39 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -100,6 +100,9 @@ namespace OpenSim.Region.Environment.Scenes
100 private LLQuaternion m_headrotation = new LLQuaternion(); 100 private LLQuaternion m_headrotation = new LLQuaternion();
101 private byte m_state = (byte) 0; 101 private byte m_state = (byte) 0;
102 102
103 //Reuse the LLVector3 instead of creating a new one on the UpdateMovement method
104 private LLVector3 movementvector = new LLVector3();
105
103 private List<LLUUID> m_knownPrimUUID = new List<LLUUID>(); 106 private List<LLUUID> m_knownPrimUUID = new List<LLUUID>();
104 107
105 // Agent's Draw distance. 108 // Agent's Draw distance.
@@ -1660,8 +1663,19 @@ namespace OpenSim.Region.Environment.Scenes
1660 NewForce force = m_forcesList[i]; 1663 NewForce force = m_forcesList[i];
1661 1664
1662 m_updateflag = true; 1665 m_updateflag = true;
1663 1666 try
1664 Velocity = new LLVector3(force.X, force.Y, force.Z); 1667 {
1668 movementvector.X = force.X;
1669 movementvector.Y = force.Y;
1670 movementvector.Z = force.Z;
1671 Velocity = movementvector;
1672 }
1673 catch (System.NullReferenceException)
1674 {
1675 // Under extreme load, this returns a NullReference Exception that we can ignore.
1676 // Ignoring this causes no movement to be sent to the physics engine...
1677 // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter!
1678 }
1665 m_newForce = true; 1679 m_newForce = true;
1666 } 1680 }
1667 for (int i = 0; i < m_forcesList.Count; i++) 1681 for (int i = 0; i < m_forcesList.Count; i++)
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 13b3f1a..b7ed417 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -317,6 +317,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
317 set { _velocity = value; } 317 set { _velocity = value; }
318 } 318 }
319 319
320 public override float CollisionScore
321 {
322 get { return 0f; }
323 }
324
320 public override Quaternion Orientation 325 public override Quaternion Orientation
321 { 326 {
322 get { return Quaternion.Identity; } 327 get { return Quaternion.Identity; }
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index fb32f93..1080aa4 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -769,7 +769,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
769 } 769 }
770 } 770 }
771 } 771 }
772 772 public override float CollisionScore
773 {
774 get { return 0f; }
775 }
773 public override PhysicsVector Size 776 public override PhysicsVector Size
774 { 777 {
775 get { return _size; } 778 get { return _size; }
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index f97b279..7741687 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -172,6 +172,8 @@ namespace OpenSim.Region.Physics.Manager
172 172
173 public abstract PhysicsVector Velocity { get; set; } 173 public abstract PhysicsVector Velocity { get; set; }
174 174
175 public abstract float CollisionScore { get;}
176
175 public abstract PhysicsVector Acceleration { get; } 177 public abstract PhysicsVector Acceleration { get; }
176 178
177 public abstract Quaternion Orientation { get; set; } 179 public abstract Quaternion Orientation { get; set; }
@@ -272,6 +274,12 @@ namespace OpenSim.Region.Physics.Manager
272 set { return; } 274 set { return; }
273 } 275 }
274 276
277 public override float CollisionScore
278 {
279 get { return 0f; }
280 }
281
282
275 public override Quaternion Orientation 283 public override Quaternion Orientation
276 { 284 {
277 get { return Quaternion.Identity; } 285 get { return Quaternion.Identity; }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 98069a0..9b75fb8 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -514,6 +514,11 @@ namespace OpenSim.Region.Physics.OdePlugin
514 } 514 }
515 } 515 }
516 516
517 public override float CollisionScore
518 {
519 get { return 0f; }
520 }
521
517 public override bool Kinematic 522 public override bool Kinematic
518 { 523 {
519 get { return false; } 524 get { return false; }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 5cdbb77..a063962 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Region.Physics.OdePlugin
55 private bool m_taintPhysics = false; 55 private bool m_taintPhysics = false;
56 public bool m_taintremove = false; 56 public bool m_taintremove = false;
57 public bool m_taintdisable = false; 57 public bool m_taintdisable = false;
58 public bool m_disabled = false;
58 59
59 private bool m_taintforce = false; 60 private bool m_taintforce = false;
60 private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); 61 private List<PhysicsVector> m_forcelist = new List<PhysicsVector>();
@@ -65,10 +66,15 @@ namespace OpenSim.Region.Physics.OdePlugin
65 public IntPtr m_targetSpace = (IntPtr) 0; 66 public IntPtr m_targetSpace = (IntPtr) 0;
66 public IntPtr prim_geom; 67 public IntPtr prim_geom;
67 public IntPtr _triMeshData; 68 public IntPtr _triMeshData;
69
68 private bool iscolliding = false; 70 private bool iscolliding = false;
69 private bool m_isphysical = false; 71 private bool m_isphysical = false;
70 private bool m_throttleUpdates = false; 72 private bool m_throttleUpdates = false;
71 private int throttleCounter = 0; 73 private int throttleCounter = 0;
74 public int m_interpenetrationcount = 0;
75 public int m_collisionscore = 0;
76 public int m_roundsUnderMotionThreshold = 0;
77
72 public bool outofBounds = false; 78 public bool outofBounds = false;
73 private float m_density = 10.000006836f; // Aluminum g/cm3; 79 private float m_density = 10.000006836f; // Aluminum g/cm3;
74 80
@@ -257,6 +263,10 @@ namespace OpenSim.Region.Physics.OdePlugin
257 d.GeomSetBody(prim_geom, Body); 263 d.GeomSetBody(prim_geom, Body);
258 d.BodySetAutoDisableFlag(Body, true); 264 d.BodySetAutoDisableFlag(Body, true);
259 d.BodySetAutoDisableSteps(Body, 20); 265 d.BodySetAutoDisableSteps(Body, 20);
266
267 m_interpenetrationcount = 0;
268 m_collisionscore = 0;
269 m_disabled = false;
260 270
261 _parent_scene.addActivePrim(this); 271 _parent_scene.addActivePrim(this);
262 } 272 }
@@ -383,6 +393,8 @@ namespace OpenSim.Region.Physics.OdePlugin
383 d.BodyDestroy(Body); 393 d.BodyDestroy(Body);
384 Body = (IntPtr) 0; 394 Body = (IntPtr) 0;
385 } 395 }
396 m_disabled = true;
397 m_collisionscore = 0;
386 } 398 }
387 399
388 public void setMesh(OdeScene parent_scene, IMesh mesh) 400 public void setMesh(OdeScene parent_scene, IMesh mesh)
@@ -425,7 +437,11 @@ namespace OpenSim.Region.Physics.OdePlugin
425 if (IsPhysical && Body == (IntPtr) 0) 437 if (IsPhysical && Body == (IntPtr) 0)
426 { 438 {
427 // Recreate the body 439 // Recreate the body
440 m_interpenetrationcount = 0;
441 m_collisionscore = 0;
442
428 enableBody(); 443 enableBody();
444
429 } 445 }
430 } 446 }
431 447
@@ -485,7 +501,7 @@ namespace OpenSim.Region.Physics.OdePlugin
485 _parent_scene.waitForSpaceUnlock(m_targetSpace); 501 _parent_scene.waitForSpaceUnlock(m_targetSpace);
486 d.SpaceAdd(m_targetSpace, prim_geom); 502 d.SpaceAdd(m_targetSpace, prim_geom);
487 } 503 }
488 504 resetCollisionAccounting();
489 m_taintposition = _position; 505 m_taintposition = _position;
490 } 506 }
491 507
@@ -501,14 +517,23 @@ namespace OpenSim.Region.Physics.OdePlugin
501 { 517 {
502 d.BodySetQuaternion(Body, ref myrot); 518 d.BodySetQuaternion(Body, ref myrot);
503 } 519 }
504 520 resetCollisionAccounting();
505 m_taintrot = _orientation; 521 m_taintrot = _orientation;
506 } 522 }
507 public void changedisable(float timestep) 523
524 private void resetCollisionAccounting()
508 { 525 {
526 m_collisionscore = 0;
527 m_interpenetrationcount = 0;
528 m_disabled = false;
529 }
530
531 public void changedisable(float timestep)
532 {
533 m_disabled = true;
509 if (Body != (IntPtr) 0) 534 if (Body != (IntPtr) 0)
510 d.BodyDisable(Body); 535 d.BodyDisable(Body);
511 536
512 m_taintdisable = false; 537 m_taintdisable = false;
513 } 538 }
514 539
@@ -528,8 +553,7 @@ namespace OpenSim.Region.Physics.OdePlugin
528 disableBody(); 553 disableBody();
529 } 554 }
530 } 555 }
531 556 resetCollisionAccounting();
532
533 m_taintPhysics = m_isphysical; 557 m_taintPhysics = m_isphysical;
534 } 558 }
535 559
@@ -670,7 +694,7 @@ namespace OpenSim.Region.Physics.OdePlugin
670 } 694 }
671 695
672 _parent_scene.geom_name_map[prim_geom] = oldname; 696 _parent_scene.geom_name_map[prim_geom] = oldname;
673 697 resetCollisionAccounting();
674 m_taintsize = _size; 698 m_taintsize = _size;
675 } 699 }
676 700
@@ -724,7 +748,7 @@ namespace OpenSim.Region.Physics.OdePlugin
724 d.GeomSetQuaternion(prim_geom, ref myrot); 748 d.GeomSetQuaternion(prim_geom, ref myrot);
725 } 749 }
726 _parent_scene.geom_name_map[prim_geom] = oldname; 750 _parent_scene.geom_name_map[prim_geom] = oldname;
727 751 resetCollisionAccounting();
728 m_taintshape = false; 752 m_taintshape = false;
729 } 753 }
730 754
@@ -746,6 +770,8 @@ namespace OpenSim.Region.Physics.OdePlugin
746 } 770 }
747 m_forcelist.Clear(); 771 m_forcelist.Clear();
748 } 772 }
773 m_collisionscore = 0;
774 m_interpenetrationcount = 0;
749 m_taintforce = false; 775 m_taintforce = false;
750 776
751 } 777 }
@@ -759,6 +785,7 @@ namespace OpenSim.Region.Physics.OdePlugin
759 d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); 785 d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z);
760 } 786 }
761 } 787 }
788 resetCollisionAccounting();
762 m_taintVelocity = PhysicsVector.Zero; 789 m_taintVelocity = PhysicsVector.Zero;
763 } 790 }
764 public override bool IsPhysical 791 public override bool IsPhysical
@@ -865,6 +892,11 @@ namespace OpenSim.Region.Physics.OdePlugin
865 } 892 }
866 } 893 }
867 894
895 public override float CollisionScore
896 {
897 get { return m_collisionscore; }
898 }
899
868 public override bool Kinematic 900 public override bool Kinematic
869 { 901 {
870 get { return false; } 902 get { return false; }
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 1aa141b..a2f354a 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -89,6 +89,9 @@ namespace OpenSim.Region.Physics.OdePlugin
89 private static float ODE_STEPSIZE = 0.020f; 89 private static float ODE_STEPSIZE = 0.020f;
90 private static bool RENDER_FLAG = false; 90 private static bool RENDER_FLAG = false;
91 private static float metersInSpace = 29.9f; 91 private static float metersInSpace = 29.9f;
92
93 private int interpenetrations_before_disable = 35;
94
92 private IntPtr contactgroup; 95 private IntPtr contactgroup;
93 private IntPtr LandGeom = (IntPtr) 0; 96 private IntPtr LandGeom = (IntPtr) 0;
94 private float[] _heightmap; 97 private float[] _heightmap;
@@ -109,13 +112,18 @@ namespace OpenSim.Region.Physics.OdePlugin
109 private d.Contact AvatarMovementprimContact; 112 private d.Contact AvatarMovementprimContact;
110 private d.Contact AvatarMovementTerrainContact; 113 private d.Contact AvatarMovementTerrainContact;
111 114
115
116
112 private int m_physicsiterations = 10; 117 private int m_physicsiterations = 10;
113 private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag 118 private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
114 private PhysicsActor PANull = new NullPhysicsActor(); 119 private PhysicsActor PANull = new NullPhysicsActor();
115 private float step_time = 0.0f; 120 private float step_time = 0.0f;
121 private int ms = 0;
116 public IntPtr world; 122 public IntPtr world;
117 123
118 public IntPtr space; 124 public IntPtr space;
125
126 private IntPtr tmpSpace;
119 // split static geometry collision handling into spaces of 30 meters 127 // split static geometry collision handling into spaces of 30 meters
120 public IntPtr[,] staticPrimspace = new IntPtr[(int) (300/metersInSpace),(int) (300/metersInSpace)]; 128 public IntPtr[,] staticPrimspace = new IntPtr[(int) (300/metersInSpace),(int) (300/metersInSpace)];
121 129
@@ -206,6 +214,14 @@ namespace OpenSim.Region.Physics.OdePlugin
206 } 214 }
207 } 215 }
208 216
217 public void starttiming()
218 {
219 ms = Environment.TickCount;
220 }
221 public int stoptiming()
222 {
223 return Environment.TickCount - ms;
224 }
209 // Initialize the mesh plugin 225 // Initialize the mesh plugin
210 public override void Initialise(IMesher meshmerizer) 226 public override void Initialise(IMesher meshmerizer)
211 { 227 {
@@ -311,6 +327,7 @@ namespace OpenSim.Region.Physics.OdePlugin
311 327
312 for (int i = 0; i < count; i++) 328 for (int i = 0; i < count; i++)
313 { 329 {
330 //m_log.Warn("[CCOUNT]: " + count);
314 IntPtr joint; 331 IntPtr joint;
315 // If we're colliding with terrain, use 'TerrainContact' instead of contact. 332 // If we're colliding with terrain, use 'TerrainContact' instead of contact.
316 // allows us to have different settings 333 // allows us to have different settings
@@ -405,13 +422,46 @@ namespace OpenSim.Region.Physics.OdePlugin
405 // If you interpenetrate a prim with another prim 422 // If you interpenetrate a prim with another prim
406 if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) 423 if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim)
407 { 424 {
408 if (contacts[i].depth >= 0.25f) 425 OdePrim op1 = (OdePrim)p1;
426 OdePrim op2 = (OdePrim)p2;
427 op1.m_collisionscore++;
428 op2.m_collisionscore++;
429
430
431 if (op1.m_collisionscore > 80 || op2.m_collisionscore > 80)
409 { 432 {
410 // Don't collide, one or both prim will explode. 433 op1.m_taintdisable = true;
411 ((OdePrim)p1).m_taintdisable = true;
412 AddPhysicsActorTaint(p1); 434 AddPhysicsActorTaint(p1);
413 ((OdePrim)p2).m_taintdisable = true; 435 op2.m_taintdisable = true;
414 AddPhysicsActorTaint(p2); 436 AddPhysicsActorTaint(p2);
437 }
438
439 if (contacts[i].depth >= 0.25f)
440 {
441 // Don't collide, one or both prim will explode.
442
443
444 op1.m_interpenetrationcount++;
445 op2.m_interpenetrationcount++;
446 interpenetrations_before_disable = 20;
447 if (op1.m_interpenetrationcount >= interpenetrations_before_disable)
448 {
449 op1.m_taintdisable = true;
450 AddPhysicsActorTaint(p1);
451 }
452 if (op2.m_interpenetrationcount >= interpenetrations_before_disable)
453 {
454 op2.m_taintdisable = true;
455 AddPhysicsActorTaint(p2);
456 }
457
458
459 //contacts[i].depth = contacts[i].depth / 8f;
460 //contacts[i].normal = new d.Vector3(0, 0, 1);
461 }
462 if (op1.m_disabled || op2.m_disabled)
463 {
464 //Manually disabled objects stay disabled
415 contacts[i].depth = 0f; 465 contacts[i].depth = 0f;
416 } 466 }
417 } 467 }
@@ -531,6 +581,7 @@ namespace OpenSim.Region.Physics.OdePlugin
531 /// <param name="timeStep"></param> 581 /// <param name="timeStep"></param>
532 private void collision_optimized(float timeStep) 582 private void collision_optimized(float timeStep)
533 { 583 {
584 starttiming();
534 foreach (OdeCharacter chr in _characters) 585 foreach (OdeCharacter chr in _characters)
535 { 586 {
536 // Reset the collision values to false 587 // Reset the collision values to false
@@ -554,6 +605,7 @@ namespace OpenSim.Region.Physics.OdePlugin
554 //forcedZ = true; 605 //forcedZ = true;
555 //} 606 //}
556 } 607 }
608 int avms = stoptiming();
557 609
558 // If the sim is running slow this frame, 610 // If the sim is running slow this frame,
559 // don't process collision for prim! 611 // don't process collision for prim!
@@ -562,9 +614,11 @@ namespace OpenSim.Region.Physics.OdePlugin
562 foreach (OdePrim chr in _activeprims) 614 foreach (OdePrim chr in _activeprims)
563 { 615 {
564 // This if may not need to be there.. it might be skipped anyway. 616 // This if may not need to be there.. it might be skipped anyway.
565 if (d.BodyIsEnabled(chr.Body)) 617 if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled))
566 { 618 {
619
567 d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback); 620 d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback);
621 //calculateSpaceForGeom(chr.Position)
568 //foreach (OdePrim ch2 in _prims) 622 //foreach (OdePrim ch2 in _prims)
569 /// should be a separate space -- lots of avatars will be N**2 slow 623 /// should be a separate space -- lots of avatars will be N**2 slow
570 //{ 624 //{
@@ -580,6 +634,7 @@ namespace OpenSim.Region.Physics.OdePlugin
580 //} 634 //}
581 //} 635 //}
582 } 636 }
637 d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback);
583 } 638 }
584 } 639 }
585 else 640 else
@@ -593,6 +648,9 @@ namespace OpenSim.Region.Physics.OdePlugin
593 { 648 {
594 // Collide test the prims with the terrain.. since if you don't do this, 649 // Collide test the prims with the terrain.. since if you don't do this,
595 // next frame, all of the physical prim in the scene will awaken and explode upwards 650 // next frame, all of the physical prim in the scene will awaken and explode upwards
651 tmpSpace = calculateSpaceForGeom(chr.Position);
652 if (tmpSpace != (IntPtr) 0 && d.GeomIsSpace(tmpSpace))
653 d.SpaceCollide2(calculateSpaceForGeom(chr.Position), chr.prim_geom, IntPtr.Zero, nearCallback);
596 d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); 654 d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback);
597 } 655 }
598 } 656 }
@@ -1140,7 +1198,14 @@ namespace OpenSim.Region.Physics.OdePlugin
1140 } 1198 }
1141 1199
1142 collision_optimized(timeStep); 1200 collision_optimized(timeStep);
1143 d.WorldQuickStep(world, ODE_STEPSIZE); 1201 try
1202 {
1203 d.WorldQuickStep(world, ODE_STEPSIZE);
1204 }
1205 catch (StackOverflowException)
1206 {
1207 d.WorldQuickStep(world, 0.001f);
1208 }
1144 d.JointGroupEmpty(contactgroup); 1209 d.JointGroupEmpty(contactgroup);
1145 foreach (OdeCharacter actor in _characters) 1210 foreach (OdeCharacter actor in _characters)
1146 { 1211 {
@@ -1165,6 +1230,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1165 RemovePrimThreadLocked(prim); 1230 RemovePrimThreadLocked(prim);
1166 } 1231 }
1167 processedtaints = true; 1232 processedtaints = true;
1233 prim.m_collisionscore = 0;
1234 }
1235
1236 foreach (OdePrim prim in _activeprims)
1237 {
1238 prim.m_collisionscore = 0;
1168 } 1239 }
1169 1240
1170 if (processedtaints) 1241 if (processedtaints)
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
index 079e66a..5b132cf 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
@@ -446,6 +446,11 @@ namespace OpenSim.Region.Physics.POSPlugin
446 set { _target_velocity = value; } 446 set { _target_velocity = value; }
447 } 447 }
448 448
449 public override float CollisionScore
450 {
451 get { return 0f; }
452 }
453
449 public override Quaternion Orientation 454 public override Quaternion Orientation
450 { 455 {
451 get { return Quaternion.Identity; } 456 get { return Quaternion.Identity; }
@@ -579,6 +584,11 @@ namespace OpenSim.Region.Physics.POSPlugin
579 set { _velocity = value; } 584 set { _velocity = value; }
580 } 585 }
581 586
587 public override float CollisionScore
588 {
589 get { return 0f; }
590 }
591
582 public override Quaternion Orientation 592 public override Quaternion Orientation
583 { 593 {
584 get { return _orientation; } 594 get { return _orientation; }
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 509bdfa..ad18507 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -325,6 +325,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
325 set { _velocity = value; } 325 set { _velocity = value; }
326 } 326 }
327 327
328 public override float CollisionScore
329 {
330 get { return 0f; }
331 }
332
328 public override bool Kinematic 333 public override bool Kinematic
329 { 334 {
330 get { return false; } 335 get { return false; }
@@ -503,6 +508,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
503 set { _velocity = value; } 508 set { _velocity = value; }
504 } 509 }
505 510
511 public override float CollisionScore
512 {
513 get { return 0f; }
514 }
515
506 public override bool Kinematic 516 public override bool Kinematic
507 { 517 {
508 get { return _prim.Kinematic; } 518 get { return _prim.Kinematic; }