From 820242bc49d9a0ed558a72fda2f7bbb85b716b5f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 27 Oct 2011 02:05:59 +0100
Subject: Fix a bug I introduced yesterday in ODE physics where prim scripts
would only receive the very first collision.
---
OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Physics/OdePlugin')
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 0363885..ea6af3a 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -193,6 +193,15 @@ namespace OpenSim.Region.Physics.OdePlugin
private int m_eventsubscription;
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
+ ///
+ /// Signal whether there were collisions on the previous frame, so we know if we need to send the
+ /// empty CollisionEventsThisFrame to the prim so that it can detect the end of a collision.
+ ///
+ ///
+ /// This is probably a temporary measure, pending storing this information consistently in CollisionEventUpdate itself.
+ ///
+ private bool m_collisionsOnPreviousFrame;
+
private IntPtr m_linkJoint = IntPtr.Zero;
internal volatile bool childPrim;
@@ -3025,8 +3034,20 @@ Console.WriteLine(" JointCreateFixed");
public void SendCollisions()
{
- if (CollisionEventsThisFrame.Count > 0)
+ if (m_collisionsOnPreviousFrame || CollisionEventsThisFrame.Count > 0)
+ {
base.SendCollisionUpdate(CollisionEventsThisFrame);
+
+ if (CollisionEventsThisFrame.Count > 0)
+ {
+ m_collisionsOnPreviousFrame = true;
+ CollisionEventsThisFrame.Clear();
+ }
+ else
+ {
+ m_collisionsOnPreviousFrame = false;
+ }
+ }
}
public override bool SubscribedEvents()
--
cgit v1.1