diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 25b3266f2b..864cdc23d1 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -147,6 +147,16 @@ namespace OpenSim.Region.Physics.OdePlugin
///
public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS";
+ ///
+ /// Stat name for the number of avatar collisions with another entity.
+ ///
+ public const string ODEAvatarCollisionsStatName = "ODEAvatarCollisions";
+
+ ///
+ /// Stat name for the number of prim collisions with another entity.
+ ///
+ public const string ODEPrimCollisionsStatName = "ODEPrimCollisions";
+
///
/// Used to hold tick numbers for stat collection purposes.
///
@@ -157,6 +167,12 @@ namespace OpenSim.Region.Physics.OdePlugin
///
private bool m_inCollisionTiming;
+ ///
+ /// A temporary holder for the number of avatar collisions in a frame, so we can work out how many object
+ /// collisions occured using the _perloopcontact if stats collection is enabled.
+ ///
+ private int m_tempAvatarCollisionsThisFrame;
+
///
/// Used in calculating physics frame time dilation
///
@@ -473,7 +489,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// Initialize the mesh plugin
public override void Initialise(IMesher meshmerizer, IConfigSource config)
{
- m_stats[ODENativeCollisionFrameMsStatName] = 0;
+ InitializeExtraStats();
mesher = meshmerizer;
m_config = config;
@@ -1455,7 +1471,7 @@ namespace OpenSim.Region.Physics.OdePlugin
break;
}
}
- //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
+ //m_log.DebugFormat("[Collision]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
//m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z));
}
}
@@ -1693,8 +1709,11 @@ namespace OpenSim.Region.Physics.OdePlugin
//}
}
-// if (framecount % 55 == 0)
-// m_log.DebugFormat("Processed {0} collisions", _perloopContact.Count);
+ if (CollectStats)
+ {
+ m_tempAvatarCollisionsThisFrame = _perloopContact.Count;
+ m_stats[ODEAvatarCollisionsStatName] += m_tempAvatarCollisionsThisFrame;
+ }
List removeprims = null;
foreach (OdePrim chr in _activeprims)
@@ -1728,6 +1747,9 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
+ if (CollectStats)
+ m_stats[ODEPrimCollisionsStatName] += _perloopContact.Count - m_tempAvatarCollisionsThisFrame;
+
if (removeprims != null)
{
foreach (OdePrim chr in removeprims)
@@ -4063,10 +4085,17 @@ namespace OpenSim.Region.Physics.OdePlugin
{
returnStats = new Dictionary(m_stats);
- m_stats[ODENativeCollisionFrameMsStatName] = 0;
+ InitializeExtraStats();
}
return returnStats;
}
+
+ private void InitializeExtraStats()
+ {
+ m_stats[ODENativeCollisionFrameMsStatName] = 0;
+ m_stats[ODEAvatarCollisionsStatName] = 0;
+ m_stats[ODEPrimCollisionsStatName] = 0;
+ }
}
}
\ No newline at end of file