- fixes a "collection out of sync" exception in the ODE physics

engine, caused by an "avatar infinite position" occurring under
  heavy load.
- fixes "value too small" exception in ChatModule
0.6.6-post-fixes
Dr Scofield 2009-06-25 07:39:48 +00:00
parent 9d07584ea1
commit 652bcf91d5
3 changed files with 55 additions and 38 deletions

View File

@ -294,7 +294,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
new Vector3(presence.Scene.RegionInfo.RegionLocX * Constants.RegionSize,
presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
int dis = Math.Abs((int) Util.GetDistanceTo(toRegionPos, fromRegionPos));
int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);
if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
type == ChatTypeEnum.Say && dis > m_saydistance ||

View File

@ -26,6 +26,7 @@
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using OpenMetaverse;
using Ode.NET;
@ -785,7 +786,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// This is the avatar's movement control + PID Controller
/// </summary>
/// <param name="timeStep"></param>
public void Move(float timeStep)
public void Move(float timeStep, List<OdeCharacter> defects)
{
// no lock; for now it's only called from within Simulate()
@ -803,11 +804,14 @@ namespace OpenSim.Region.Physics.OdePlugin
d.Vector3 localpos = d.BodyGetPosition(Body);
PhysicsVector localPos = new PhysicsVector(localpos.X, localpos.Y, localpos.Z);
if (!PhysicsVector.isFinite(localPos))
{
m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
_parent_scene.RemoveCharacter(this);
defects.Add(this);
// _parent_scene.RemoveCharacter(this);
// destroy avatar capsule and related ODE data
if (Amotor != IntPtr.Zero)
{
@ -815,6 +819,7 @@ namespace OpenSim.Region.Physics.OdePlugin
d.JointDestroy(Amotor);
Amotor = IntPtr.Zero;
}
//kill the Geometry
_parent_scene.waitForSpaceUnlock(_parent_scene.space);
@ -958,7 +963,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{
m_log.Warn("[PHYSICS]: Got a NaN force vector in Move()");
m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
_parent_scene.RemoveCharacter(this);
defects.Add(this);
// _parent_scene.RemoveCharacter(this);
// destroy avatar capsule and related ODE data
if (Amotor != IntPtr.Zero)
{

View File

@ -1434,6 +1434,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{
_perloopContact.Clear();
lock (_characters)
{
foreach (OdeCharacter chr in _characters)
{
// Reset the collision values to false
@ -1471,6 +1473,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//forcedZ = true;
//}
}
}
lock (_activeprims)
{
@ -2799,10 +2802,18 @@ namespace OpenSim.Region.Physics.OdePlugin
// Move characters
lock (_characters)
{
List<OdeCharacter> defects = new List<OdeCharacter>();
foreach (OdeCharacter actor in _characters)
{
if (actor != null)
actor.Move(timeStep);
actor.Move(timeStep, defects);
}
if (0 != defects.Count)
{
foreach (OdeCharacter defect in defects)
{
RemoveCharacter(defect);
}
}
}