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 | |
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 '')
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 16 |
2 files changed, 8 insertions, 13 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 1659ebd..44af636 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -70,6 +70,11 @@ namespace OpenSim.Region.Physics.Manager | |||
70 | { | 70 | { |
71 | // Raising the event on the object, so don't need to provide location.. further up the tree knows that info. | 71 | // Raising the event on the object, so don't need to provide location.. further up the tree knows that info. |
72 | 72 | ||
73 | /// <summary> | ||
74 | /// Number of collision events in this update. | ||
75 | /// </summary> | ||
76 | public int Count { get { return m_objCollisionList.Count; } } | ||
77 | |||
73 | public int m_colliderType; | 78 | public int m_colliderType; |
74 | public int m_GenericStartEnd; | 79 | public int m_GenericStartEnd; |
75 | //public uint m_LocalID; | 80 | //public uint m_LocalID; |
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() |