From f1495cb237d23955a3bba32d9c6978bca4943026 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 17 Aug 2016 22:34:21 +0100 Subject: [PATCH] ubOde reduce collision_start latency in same cases (only one collision happening and more than 50ms since last) --- OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | 5 ++--- OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 13 ++++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index cef7063a2d..c9489d2622 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -1605,18 +1605,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_cureventsubscription < m_eventsubscription) return; - m_cureventsubscription = 0; - int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; if (!SentEmptyCollisionsEvent || ncolisions > 0) { base.SendCollisionUpdate(CollisionEventsThisFrame); + m_cureventsubscription = 0; if (ncolisions == 0) { SentEmptyCollisionsEvent = true; - _parent_scene.RemoveCollisionEventReporting(this); +// _parent_scene.RemoveCollisionEventReporting(this); } else { diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 9f62644f67..6f2cbbe5b2 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs @@ -1000,9 +1000,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { - if (CollisionEventsThisFrame == null) CollisionEventsThisFrame = new CollisionEventUpdate(); + CollisionEventsThisFrame.AddCollider(CollidedWith, contact); _parent_scene.AddCollisionEventReporting(this); } @@ -1033,28 +1033,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (CollisionEventsThisFrame == null) return; + int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; + if (m_cureventsubscription < m_eventsubscription) return; - m_cureventsubscription = 0; - - int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; - if (!SentEmptyCollisionsEvent || ncolisions > 0) { base.SendCollisionUpdate(CollisionEventsThisFrame); + m_cureventsubscription = 0; if (ncolisions == 0) { SentEmptyCollisionsEvent = true; - _parent_scene.RemoveCollisionEventReporting(this); +// _parent_scene.RemoveCollisionEventReporting(this); } else if(Body == IntPtr.Zero || d.BodyIsEnabled(Body)) { SentEmptyCollisionsEvent = false; CollisionEventsThisFrame.Clear(); } - } + } } public override bool SubscribedEvents()