For ScenePresence collision events, instead of creating a new CollisionEventsThisFrame every time we need to send some new ones, reuse the existing one instead.

This assumes that the listener is using the data synchronously, which is currently the case.
remove-scene-viewer
Justin Clark-Casey (justincc) 2011-10-25 22:19:17 +01:00
parent 7b6b36cee9
commit 5d37f0471e
3 changed files with 17 additions and 9 deletions

View File

@ -2248,6 +2248,7 @@ namespace OpenSim.Region.Framework.Scenes
}); });
} }
} }
if (colliding.Count > 0) if (colliding.Count > 0)
{ {
StartCollidingMessage.Colliders = colliding; StartCollidingMessage.Colliders = colliding;
@ -2255,10 +2256,11 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
if (m_parentGroup.PassCollision == true) // if (m_parentGroup.PassCollision == true)
{ // {
//TODO: Add pass to root prim! // //TODO: Add pass to root prim!
} // }
m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage); m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage);
} }
} }

View File

@ -113,6 +113,14 @@ namespace OpenSim.Region.Physics.Manager
m_objCollisionList[localID] = contact; m_objCollisionList[localID] = contact;
} }
} }
/// <summary>
/// Clear added collision events.
/// </summary>
public void Clear()
{
m_objCollisionList.Clear();
}
} }
public abstract class PhysicsActor public abstract class PhysicsActor

View File

@ -1235,11 +1235,9 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (m_eventsubscription > m_requestedUpdateFrequency) if (m_eventsubscription > m_requestedUpdateFrequency)
{ {
if (CollisionEventsThisFrame != null) base.SendCollisionUpdate(CollisionEventsThisFrame);
{
base.SendCollisionUpdate(CollisionEventsThisFrame); CollisionEventsThisFrame.Clear();
}
CollisionEventsThisFrame = new CollisionEventUpdate();
m_eventsubscription = 0; m_eventsubscription = 0;
} }
} }