diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 17 |
3 files changed, 19 insertions, 28 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index e9bab66..c22d27f 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -1210,11 +1210,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1210 | { | 1210 | { |
1211 | m_requestedUpdateFrequency = ms; | 1211 | m_requestedUpdateFrequency = ms; |
1212 | m_eventsubscription = ms; | 1212 | m_eventsubscription = ms; |
1213 | CollisionEventsThisFrame.Clear(); | ||
1213 | _parent_scene.AddCollisionEventReporting(this); | 1214 | _parent_scene.AddCollisionEventReporting(this); |
1214 | } | 1215 | } |
1215 | 1216 | ||
1216 | public override void UnSubscribeEvents() | 1217 | public override void UnSubscribeEvents() |
1217 | { | 1218 | { |
1219 | CollisionEventsThisFrame.Clear(); | ||
1218 | _parent_scene.RemoveCollisionEventReporting(this); | 1220 | _parent_scene.RemoveCollisionEventReporting(this); |
1219 | m_requestedUpdateFrequency = 0; | 1221 | m_requestedUpdateFrequency = 0; |
1220 | m_eventsubscription = 0; | 1222 | m_eventsubscription = 0; |
@@ -1227,7 +1229,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1227 | // m_log.DebugFormat( | 1229 | // m_log.DebugFormat( |
1228 | // "[PHYSICS]: Adding collision event for {0}, collidedWith {1}, contact {2}", "", CollidedWith, contact); | 1230 | // "[PHYSICS]: Adding collision event for {0}, collidedWith {1}, contact {2}", "", CollidedWith, contact); |
1229 | 1231 | ||
1230 | CollisionEventsThisFrame.addCollider(CollidedWith, contact); | 1232 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); |
1231 | } | 1233 | } |
1232 | } | 1234 | } |
1233 | 1235 | ||
@@ -1235,11 +1237,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1235 | { | 1237 | { |
1236 | if (m_eventsubscription > m_requestedUpdateFrequency) | 1238 | if (m_eventsubscription > m_requestedUpdateFrequency) |
1237 | { | 1239 | { |
1238 | if (CollisionEventsThisFrame != null) | 1240 | base.SendCollisionUpdate(CollisionEventsThisFrame); |
1239 | { | 1241 | |
1240 | base.SendCollisionUpdate(CollisionEventsThisFrame); | 1242 | CollisionEventsThisFrame.Clear(); |
1241 | } | ||
1242 | CollisionEventsThisFrame = new CollisionEventUpdate(); | ||
1243 | m_eventsubscription = 0; | 1243 | m_eventsubscription = 0; |
1244 | } | 1244 | } |
1245 | } | 1245 | } |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 6638cbd..3a17511 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) | 3023 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); |
3024 | CollisionEventsThisFrame = new CollisionEventUpdate(); | ||
3025 | |||
3026 | 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() |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 0810ae0..c3279c6 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -1633,6 +1633,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1633 | /// <param name="obj"></param> | 1633 | /// <param name="obj"></param> |
1634 | internal void AddCollisionEventReporting(PhysicsActor obj) | 1634 | internal void AddCollisionEventReporting(PhysicsActor obj) |
1635 | { | 1635 | { |
1636 | // m_log.DebugFormat("[PHYSICS]: Adding {0} to collision event reporting", obj.SOPName); | ||
1637 | |||
1636 | lock (_collisionEventPrim) | 1638 | lock (_collisionEventPrim) |
1637 | { | 1639 | { |
1638 | if (!_collisionEventPrim.Contains(obj)) | 1640 | if (!_collisionEventPrim.Contains(obj)) |
@@ -1646,11 +1648,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1646 | /// <param name="obj"></param> | 1648 | /// <param name="obj"></param> |
1647 | internal void RemoveCollisionEventReporting(PhysicsActor obj) | 1649 | internal void RemoveCollisionEventReporting(PhysicsActor obj) |
1648 | { | 1650 | { |
1651 | // m_log.DebugFormat("[PHYSICS]: Removing {0} from collision event reporting", obj.SOPName); | ||
1652 | |||
1649 | lock (_collisionEventPrim) | 1653 | lock (_collisionEventPrim) |
1650 | { | 1654 | _collisionEventPrim.Remove(obj); |
1651 | if (!_collisionEventPrim.Contains(obj)) | ||
1652 | _collisionEventPrim.Remove(obj); | ||
1653 | } | ||
1654 | } | 1655 | } |
1655 | 1656 | ||
1656 | #region Add/Remove Entities | 1657 | #region Add/Remove Entities |
@@ -2859,14 +2860,14 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2859 | { | 2860 | { |
2860 | //if (timeStep < 0.2f) | 2861 | //if (timeStep < 0.2f) |
2861 | { | 2862 | { |
2862 | foreach (OdePrim actor in _activeprims) | 2863 | foreach (OdePrim prim in _activeprims) |
2863 | { | 2864 | { |
2864 | if (actor.IsPhysical && (d.BodyIsEnabled(actor.Body) || !actor._zeroFlag)) | 2865 | if (prim.IsPhysical && (d.BodyIsEnabled(prim.Body) || !prim._zeroFlag)) |
2865 | { | 2866 | { |
2866 | actor.UpdatePositionAndVelocity(); | 2867 | prim.UpdatePositionAndVelocity(); |
2867 | 2868 | ||
2868 | if (SupportsNINJAJoints) | 2869 | if (SupportsNINJAJoints) |
2869 | SimulateActorPendingJoints(actor); | 2870 | SimulateActorPendingJoints(prim); |
2870 | } | 2871 | } |
2871 | } | 2872 | } |
2872 | } | 2873 | } |