From 5d37f0471ea504b1426536987d05c7d64dd199ae Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 25 Oct 2011 22:19:17 +0100 Subject: 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. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 ++++++---- OpenSim/Region/Physics/Manager/PhysicsActor.cs | 8 ++++++++ OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 8 +++----- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c25c3b4..bee96d1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2248,6 +2248,7 @@ namespace OpenSim.Region.Framework.Scenes }); } } + if (colliding.Count > 0) { StartCollidingMessage.Colliders = colliding; @@ -2255,10 +2256,11 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup.Scene == null) return; - if (m_parentGroup.PassCollision == true) - { - //TODO: Add pass to root prim! - } +// if (m_parentGroup.PassCollision == true) +// { +// //TODO: Add pass to root prim! +// } + m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage); } } diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 96dcfb6..1659ebd 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -113,6 +113,14 @@ namespace OpenSim.Region.Physics.Manager m_objCollisionList[localID] = contact; } } + + /// + /// Clear added collision events. + /// + public void Clear() + { + m_objCollisionList.Clear(); + } } public abstract class PhysicsActor diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index e9bab66..55e14bc 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -1235,11 +1235,9 @@ namespace OpenSim.Region.Physics.OdePlugin { if (m_eventsubscription > m_requestedUpdateFrequency) { - if (CollisionEventsThisFrame != null) - { - base.SendCollisionUpdate(CollisionEventsThisFrame); - } - CollisionEventsThisFrame = new CollisionEventUpdate(); + base.SendCollisionUpdate(CollisionEventsThisFrame); + + CollisionEventsThisFrame.Clear(); m_eventsubscription = 0; } } -- cgit v1.1