diff options
author | Justin Clark-Casey (justincc) | 2011-10-27 02:05:59 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-27 02:05:59 +0100 |
commit | 820242bc49d9a0ed558a72fda2f7bbb85b716b5f (patch) | |
tree | 179eca9de94ddb5f592f3dab75d544f4cd9cabe0 | |
parent | Restart the event queue worker threads that I accidentally disabled earlier t... (diff) | |
download | opensim-SC_OLD-820242bc49d9a0ed558a72fda2f7bbb85b716b5f.zip opensim-SC_OLD-820242bc49d9a0ed558a72fda2f7bbb85b716b5f.tar.gz opensim-SC_OLD-820242bc49d9a0ed558a72fda2f7bbb85b716b5f.tar.bz2 opensim-SC_OLD-820242bc49d9a0ed558a72fda2f7bbb85b716b5f.tar.xz |
Fix a bug I introduced yesterday in ODE physics where prim scripts would only receive the very first collision.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 23 |
3 files changed, 26 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8b68102..c8ecc9b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2082,6 +2082,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2082 | 2082 | ||
2083 | public void PhysicsCollision(EventArgs e) | 2083 | public void PhysicsCollision(EventArgs e) |
2084 | { | 2084 | { |
2085 | // m_log.DebugFormat("Invoking PhysicsCollision on {0} {1} {2}", Name, LocalId, UUID); | ||
2086 | |||
2085 | // single threaded here | 2087 | // single threaded here |
2086 | 2088 | ||
2087 | CollisionEventUpdate a = (CollisionEventUpdate)e; | 2089 | CollisionEventUpdate a = (CollisionEventUpdate)e; |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 362f997..49f60f8 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -76,6 +76,8 @@ namespace OpenSim.Region.Physics.Manager | |||
76 | /// </summary> | 76 | /// </summary> |
77 | public int Count { get { return m_objCollisionList.Count; } } | 77 | public int Count { get { return m_objCollisionList.Count; } } |
78 | 78 | ||
79 | public bool CollisionsOnPreviousFrame { get; private set; } | ||
80 | |||
79 | public Dictionary<uint, ContactPoint> m_objCollisionList; | 81 | public Dictionary<uint, ContactPoint> m_objCollisionList; |
80 | 82 | ||
81 | public CollisionEventUpdate(Dictionary<uint, ContactPoint> objCollisionList) | 83 | public CollisionEventUpdate(Dictionary<uint, ContactPoint> objCollisionList) |
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 | |||
193 | private int m_eventsubscription; | 193 | private int m_eventsubscription; |
194 | private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); | 194 | private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); |
195 | 195 | ||
196 | /// <summary> | ||
197 | /// Signal whether there were collisions on the previous frame, so we know if we need to send the | ||
198 | /// empty CollisionEventsThisFrame to the prim so that it can detect the end of a collision. | ||
199 | /// </summary> | ||
200 | /// <remarks> | ||
201 | /// This is probably a temporary measure, pending storing this information consistently in CollisionEventUpdate itself. | ||
202 | /// </remarks> | ||
203 | private bool m_collisionsOnPreviousFrame; | ||
204 | |||
196 | private IntPtr m_linkJoint = IntPtr.Zero; | 205 | private IntPtr m_linkJoint = IntPtr.Zero; |
197 | 206 | ||
198 | internal volatile bool childPrim; | 207 | internal volatile bool childPrim; |
@@ -3025,8 +3034,20 @@ Console.WriteLine(" JointCreateFixed"); | |||
3025 | 3034 | ||
3026 | public void SendCollisions() | 3035 | public void SendCollisions() |
3027 | { | 3036 | { |
3028 | if (CollisionEventsThisFrame.Count > 0) | 3037 | if (m_collisionsOnPreviousFrame || CollisionEventsThisFrame.Count > 0) |
3038 | { | ||
3029 | base.SendCollisionUpdate(CollisionEventsThisFrame); | 3039 | base.SendCollisionUpdate(CollisionEventsThisFrame); |
3040 | |||
3041 | if (CollisionEventsThisFrame.Count > 0) | ||
3042 | { | ||
3043 | m_collisionsOnPreviousFrame = true; | ||
3044 | CollisionEventsThisFrame.Clear(); | ||
3045 | } | ||
3046 | else | ||
3047 | { | ||
3048 | m_collisionsOnPreviousFrame = false; | ||
3049 | } | ||
3050 | } | ||
3030 | } | 3051 | } |
3031 | 3052 | ||
3032 | public override bool SubscribedEvents() | 3053 | public override bool SubscribedEvents() |