Instead of generating a new list for bad characters on every physics pass, keep reusing the same list.
parent
f3b45be9c0
commit
c253539c04
|
@ -188,10 +188,19 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private d.NearCallback nearCallback;
|
private d.NearCallback nearCallback;
|
||||||
public d.TriCallback triCallback;
|
public d.TriCallback triCallback;
|
||||||
public d.TriArrayCallback triArrayCallback;
|
public d.TriArrayCallback triArrayCallback;
|
||||||
|
|
||||||
private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
|
private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
|
||||||
private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>();
|
private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>();
|
||||||
private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
|
private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defects list to remove characters that no longer have finite positions due to some other bug.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Used repeatedly in Simulate() but initialized once here.
|
||||||
|
/// </remarks>
|
||||||
|
private readonly List<OdeCharacter> defects = new List<OdeCharacter>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to lock on manipulation of _taintedPrimL and _taintedPrimH
|
/// Used to lock on manipulation of _taintedPrimL and _taintedPrimH
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2757,18 +2766,18 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
|
||||||
// Move characters
|
// Move characters
|
||||||
lock (_characters)
|
lock (_characters)
|
||||||
{
|
{
|
||||||
List<OdeCharacter> defects = new List<OdeCharacter>();
|
|
||||||
foreach (OdeCharacter actor in _characters)
|
foreach (OdeCharacter actor in _characters)
|
||||||
{
|
{
|
||||||
if (actor != null)
|
if (actor != null)
|
||||||
actor.Move(defects);
|
actor.Move(defects);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != defects.Count)
|
if (0 != defects.Count)
|
||||||
{
|
{
|
||||||
foreach (OdeCharacter defect in defects)
|
foreach (OdeCharacter defect in defects)
|
||||||
{
|
|
||||||
RemoveCharacter(defect);
|
RemoveCharacter(defect);
|
||||||
}
|
|
||||||
|
defects.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue