aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs12
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs77
3 files changed, 55 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 2814e92..dba6b38 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -294,8 +294,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
294 new Vector3(presence.Scene.RegionInfo.RegionLocX * Constants.RegionSize, 294 new Vector3(presence.Scene.RegionInfo.RegionLocX * Constants.RegionSize,
295 presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); 295 presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
296 296
297 int dis = Math.Abs((int) Util.GetDistanceTo(toRegionPos, fromRegionPos)); 297 int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);
298 298
299 if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || 299 if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
300 type == ChatTypeEnum.Say && dis > m_saydistance || 300 type == ChatTypeEnum.Say && dis > m_saydistance ||
301 type == ChatTypeEnum.Shout && dis > m_shoutdistance) 301 type == ChatTypeEnum.Shout && dis > m_shoutdistance)
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 3f0d6c1..e5e7d07 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using OpenMetaverse; 31using OpenMetaverse;
31using Ode.NET; 32using Ode.NET;
@@ -785,7 +786,7 @@ namespace OpenSim.Region.Physics.OdePlugin
785 /// This is the avatar's movement control + PID Controller 786 /// This is the avatar's movement control + PID Controller
786 /// </summary> 787 /// </summary>
787 /// <param name="timeStep"></param> 788 /// <param name="timeStep"></param>
788 public void Move(float timeStep) 789 public void Move(float timeStep, List<OdeCharacter> defects)
789 { 790 {
790 // no lock; for now it's only called from within Simulate() 791 // no lock; for now it's only called from within Simulate()
791 792
@@ -803,11 +804,14 @@ namespace OpenSim.Region.Physics.OdePlugin
803 804
804 d.Vector3 localpos = d.BodyGetPosition(Body); 805 d.Vector3 localpos = d.BodyGetPosition(Body);
805 PhysicsVector localPos = new PhysicsVector(localpos.X, localpos.Y, localpos.Z); 806 PhysicsVector localPos = new PhysicsVector(localpos.X, localpos.Y, localpos.Z);
807
806 if (!PhysicsVector.isFinite(localPos)) 808 if (!PhysicsVector.isFinite(localPos))
807 { 809 {
808 810
809 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); 811 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
810 _parent_scene.RemoveCharacter(this); 812 defects.Add(this);
813 // _parent_scene.RemoveCharacter(this);
814
811 // destroy avatar capsule and related ODE data 815 // destroy avatar capsule and related ODE data
812 if (Amotor != IntPtr.Zero) 816 if (Amotor != IntPtr.Zero)
813 { 817 {
@@ -815,6 +819,7 @@ namespace OpenSim.Region.Physics.OdePlugin
815 d.JointDestroy(Amotor); 819 d.JointDestroy(Amotor);
816 Amotor = IntPtr.Zero; 820 Amotor = IntPtr.Zero;
817 } 821 }
822
818 //kill the Geometry 823 //kill the Geometry
819 _parent_scene.waitForSpaceUnlock(_parent_scene.space); 824 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
820 825
@@ -958,7 +963,8 @@ namespace OpenSim.Region.Physics.OdePlugin
958 { 963 {
959 m_log.Warn("[PHYSICS]: Got a NaN force vector in Move()"); 964 m_log.Warn("[PHYSICS]: Got a NaN force vector in Move()");
960 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); 965 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
961 _parent_scene.RemoveCharacter(this); 966 defects.Add(this);
967 // _parent_scene.RemoveCharacter(this);
962 // destroy avatar capsule and related ODE data 968 // destroy avatar capsule and related ODE data
963 if (Amotor != IntPtr.Zero) 969 if (Amotor != IntPtr.Zero)
964 { 970 {
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 46689eb..0f92358 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1434,42 +1434,45 @@ namespace OpenSim.Region.Physics.OdePlugin
1434 { 1434 {
1435 _perloopContact.Clear(); 1435 _perloopContact.Clear();
1436 1436
1437 foreach (OdeCharacter chr in _characters) 1437 lock (_characters)
1438 { 1438 {
1439 // Reset the collision values to false 1439 foreach (OdeCharacter chr in _characters)
1440 // since we don't know if we're colliding yet
1441
1442 // For some reason this can happen. Don't ask...
1443 //
1444 if (chr == null)
1445 continue;
1446
1447 if (chr.Shell == IntPtr.Zero || chr.Body == IntPtr.Zero)
1448 continue;
1449
1450 chr.IsColliding = false;
1451 chr.CollidingGround = false;
1452 chr.CollidingObj = false;
1453
1454 // test the avatar's geometry for collision with the space
1455 // This will return near and the space that they are the closest to
1456 // And we'll run this again against the avatar and the space segment
1457 // This will return with a bunch of possible objects in the space segment
1458 // and we'll run it again on all of them.
1459 try
1460 {
1461 d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback);
1462 }
1463 catch (AccessViolationException)
1464 { 1440 {
1465 m_log.Warn("[PHYSICS]: Unable to space collide"); 1441 // Reset the collision values to false
1466 } 1442 // since we don't know if we're colliding yet
1467 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); 1443
1468 //if (chr.Position.Z + (chr.Velocity.Z * timeStep) < terrainheight + 10) 1444 // For some reason this can happen. Don't ask...
1469 //{ 1445 //
1446 if (chr == null)
1447 continue;
1448
1449 if (chr.Shell == IntPtr.Zero || chr.Body == IntPtr.Zero)
1450 continue;
1451
1452 chr.IsColliding = false;
1453 chr.CollidingGround = false;
1454 chr.CollidingObj = false;
1455
1456 // test the avatar's geometry for collision with the space
1457 // This will return near and the space that they are the closest to
1458 // And we'll run this again against the avatar and the space segment
1459 // This will return with a bunch of possible objects in the space segment
1460 // and we'll run it again on all of them.
1461 try
1462 {
1463 d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback);
1464 }
1465 catch (AccessViolationException)
1466 {
1467 m_log.Warn("[PHYSICS]: Unable to space collide");
1468 }
1469 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y);
1470 //if (chr.Position.Z + (chr.Velocity.Z * timeStep) < terrainheight + 10)
1471 //{
1470 //chr.Position.Z = terrainheight + 10.0f; 1472 //chr.Position.Z = terrainheight + 10.0f;
1471 //forcedZ = true; 1473 //forcedZ = true;
1472 //} 1474 //}
1475 }
1473 } 1476 }
1474 1477
1475 lock (_activeprims) 1478 lock (_activeprims)
@@ -2799,10 +2802,18 @@ namespace OpenSim.Region.Physics.OdePlugin
2799 // Move characters 2802 // Move characters
2800 lock (_characters) 2803 lock (_characters)
2801 { 2804 {
2805 List<OdeCharacter> defects = new List<OdeCharacter>();
2802 foreach (OdeCharacter actor in _characters) 2806 foreach (OdeCharacter actor in _characters)
2803 { 2807 {
2804 if (actor != null) 2808 if (actor != null)
2805 actor.Move(timeStep); 2809 actor.Move(timeStep, defects);
2810 }
2811 if (0 != defects.Count)
2812 {
2813 foreach (OdeCharacter defect in defects)
2814 {
2815 RemoveCharacter(defect);
2816 }
2806 } 2817 }
2807 } 2818 }
2808 2819