diff options
author | Justin Clark-Casey (justincc) | 2011-10-25 22:28:40 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-25 22:28:40 +0100 |
commit | b9f106f484e3b80c4572f10e81c20da254b5cbae (patch) | |
tree | a27925cbfcfec362926d508804ea178f75de122c /OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |
parent | For ScenePresence collision events, instead of creating a new CollisionEvents... (diff) | |
download | opensim-SC_OLD-b9f106f484e3b80c4572f10e81c20da254b5cbae.zip opensim-SC_OLD-b9f106f484e3b80c4572f10e81c20da254b5cbae.tar.gz opensim-SC_OLD-b9f106f484e3b80c4572f10e81c20da254b5cbae.tar.bz2 opensim-SC_OLD-b9f106f484e3b80c4572f10e81c20da254b5cbae.tar.xz |
When sending object collision updates, don't null out and recreate the CollisionEventUpdate() if the number of collisions falls to zero. Reuse the existing one instead.
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 3087f8d..4ef731d 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -191,7 +191,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
191 | private d.Mass pMass; | 191 | private d.Mass pMass; |
192 | 192 | ||
193 | private int m_eventsubscription; | 193 | private int m_eventsubscription; |
194 | private CollisionEventUpdate CollisionEventsThisFrame; | 194 | private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); |
195 | 195 | ||
196 | private IntPtr m_linkJoint = IntPtr.Zero; | 196 | private IntPtr m_linkJoint = IntPtr.Zero; |
197 | 197 | ||
@@ -3020,23 +3020,13 @@ Console.WriteLine(" JointCreateFixed"); | |||
3020 | 3020 | ||
3021 | public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) | 3021 | public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) |
3022 | { | 3022 | { |
3023 | if (CollisionEventsThisFrame == null) | ||
3024 | CollisionEventsThisFrame = new CollisionEventUpdate(); | ||
3025 | |||
3026 | CollisionEventsThisFrame.addCollider(CollidedWith, contact); | 3023 | CollisionEventsThisFrame.addCollider(CollidedWith, contact); |
3027 | } | 3024 | } |
3028 | 3025 | ||
3029 | public void SendCollisions() | 3026 | public void SendCollisions() |
3030 | { | 3027 | { |
3031 | if (CollisionEventsThisFrame == null) | 3028 | if (CollisionEventsThisFrame.Count > 0) |
3032 | return; | 3029 | base.SendCollisionUpdate(CollisionEventsThisFrame); |
3033 | |||
3034 | base.SendCollisionUpdate(CollisionEventsThisFrame); | ||
3035 | |||
3036 | if (CollisionEventsThisFrame.m_objCollisionList.Count == 0) | ||
3037 | CollisionEventsThisFrame = null; | ||
3038 | else | ||
3039 | CollisionEventsThisFrame = new CollisionEventUpdate(); | ||
3040 | } | 3030 | } |
3041 | 3031 | ||
3042 | public override bool SubscribedEvents() | 3032 | public override bool SubscribedEvents() |