Fix OdeScene.GetTopColliders() to return the top 25 colliders rather than the first 25 that had non-zero collision scores.
Also zeros collisions scores on all prims after report collection, not just the top 25. As before, this collision scores are only reset after a report is requested, which may give unrealistic numbers on the first request. So to see more realistic scores, ignore the first report and then refresh the request after a couple of seconds or so.0.7.3-extended
parent
2fc461d9ab
commit
68946bffae
|
@ -30,20 +30,21 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.IO;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using Ode.NET;
|
using Ode.NET;
|
||||||
|
using OpenMetaverse;
|
||||||
#if USE_DRAWSTUFF
|
#if USE_DRAWSTUFF
|
||||||
using Drawstuff.NET;
|
using Drawstuff.NET;
|
||||||
#endif
|
#endif
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
using OpenMetaverse;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.OdePlugin
|
namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
|
@ -3868,26 +3869,19 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
public override Dictionary<uint, float> GetTopColliders()
|
public override Dictionary<uint, float> GetTopColliders()
|
||||||
{
|
{
|
||||||
Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
|
Dictionary<uint, float> topColliders;
|
||||||
int cnt = 0;
|
|
||||||
lock (_prims)
|
lock (_prims)
|
||||||
{
|
{
|
||||||
foreach (OdePrim prm in _prims)
|
List<OdePrim> orderedPrims = new List<OdePrim>(_prims);
|
||||||
{
|
orderedPrims.OrderByDescending(p => p.CollisionScore).Take(25);
|
||||||
if (prm.CollisionScore > 0)
|
topColliders = orderedPrims.ToDictionary(p => p.LocalID, p => p.CollisionScore);
|
||||||
{
|
|
||||||
returncolliders.Add(prm.LocalID, prm.CollisionScore);
|
foreach (OdePrim p in _prims)
|
||||||
cnt++;
|
p.CollisionScore = 0;
|
||||||
prm.CollisionScore = 0f;
|
|
||||||
if (cnt > 25)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return returncolliders;
|
return topColliders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool SupportsRayCast()
|
public override bool SupportsRayCast()
|
||||||
|
|
Loading…
Reference in New Issue