diff options
author | Justin Clark-Casey (justincc) | 2011-10-25 22:19:17 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-25 22:19:17 +0100 |
commit | 5d37f0471ea504b1426536987d05c7d64dd199ae (patch) | |
tree | 66c539fdad4f63939ff3e976240e5a57d2952759 | |
parent | Fix bug where collision event listeners were not removed once the listener ha... (diff) | |
download | opensim-SC-5d37f0471ea504b1426536987d05c7d64dd199ae.zip opensim-SC-5d37f0471ea504b1426536987d05c7d64dd199ae.tar.gz opensim-SC-5d37f0471ea504b1426536987d05c7d64dd199ae.tar.bz2 opensim-SC-5d37f0471ea504b1426536987d05c7d64dd199ae.tar.xz |
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.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 8 | ||||
-rw-r--r-- | 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 | |||
2248 | }); | 2248 | }); |
2249 | } | 2249 | } |
2250 | } | 2250 | } |
2251 | |||
2251 | if (colliding.Count > 0) | 2252 | if (colliding.Count > 0) |
2252 | { | 2253 | { |
2253 | StartCollidingMessage.Colliders = colliding; | 2254 | StartCollidingMessage.Colliders = colliding; |
@@ -2255,10 +2256,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2255 | if (m_parentGroup.Scene == null) | 2256 | if (m_parentGroup.Scene == null) |
2256 | return; | 2257 | return; |
2257 | 2258 | ||
2258 | if (m_parentGroup.PassCollision == true) | 2259 | // if (m_parentGroup.PassCollision == true) |
2259 | { | 2260 | // { |
2260 | //TODO: Add pass to root prim! | 2261 | // //TODO: Add pass to root prim! |
2261 | } | 2262 | // } |
2263 | |||
2262 | m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage); | 2264 | m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage); |
2263 | } | 2265 | } |
2264 | } | 2266 | } |
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 | |||
113 | m_objCollisionList[localID] = contact; | 113 | m_objCollisionList[localID] = contact; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | |||
117 | /// <summary> | ||
118 | /// Clear added collision events. | ||
119 | /// </summary> | ||
120 | public void Clear() | ||
121 | { | ||
122 | m_objCollisionList.Clear(); | ||
123 | } | ||
116 | } | 124 | } |
117 | 125 | ||
118 | public abstract class PhysicsActor | 126 | 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 | |||
1235 | { | 1235 | { |
1236 | if (m_eventsubscription > m_requestedUpdateFrequency) | 1236 | if (m_eventsubscription > m_requestedUpdateFrequency) |
1237 | { | 1237 | { |
1238 | if (CollisionEventsThisFrame != null) | 1238 | base.SendCollisionUpdate(CollisionEventsThisFrame); |
1239 | { | 1239 | |
1240 | base.SendCollisionUpdate(CollisionEventsThisFrame); | 1240 | CollisionEventsThisFrame.Clear(); |
1241 | } | ||
1242 | CollisionEventsThisFrame = new CollisionEventUpdate(); | ||
1243 | m_eventsubscription = 0; | 1241 | m_eventsubscription = 0; |
1244 | } | 1242 | } |
1245 | } | 1243 | } |