diff options
author | Melanie | 2012-05-15 21:24:27 +0100 |
---|---|---|
committer | Melanie | 2012-05-15 21:24:27 +0100 |
commit | 81ce169dfe4c498d6fda7bb2393bfec56065affc (patch) | |
tree | f7ceaf7d145aaf3fa263933bbad847ef42a93c50 /OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | use part VolumeDetectActive and not rootPart.VolumeDetectActive to be coeren... (diff) | |
download | opensim-SC-81ce169dfe4c498d6fda7bb2393bfec56065affc.zip opensim-SC-81ce169dfe4c498d6fda7bb2393bfec56065affc.tar.gz opensim-SC-81ce169dfe4c498d6fda7bb2393bfec56065affc.tar.bz2 opensim-SC-81ce169dfe4c498d6fda7bb2393bfec56065affc.tar.xz |
Merge branch 'avination' into careminster
Conflicts:
OpenSim/Data/MySQL/MySQLSimulationData.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 87a7e51..5db4f17 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -194,8 +194,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
194 | public int givefakeori = 0; | 194 | public int givefakeori = 0; |
195 | private Quaternion fakeori; | 195 | private Quaternion fakeori; |
196 | 196 | ||
197 | public int m_eventsubscription; | 197 | private int m_eventsubscription; |
198 | private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); | 198 | private int m_cureventsubscription; |
199 | private CollisionEventUpdate CollisionEventsThisFrame = null; | ||
200 | private bool SentEmptyCollisionsEvent; | ||
199 | 201 | ||
200 | public volatile bool childPrim; | 202 | public volatile bool childPrim; |
201 | 203 | ||
@@ -931,12 +933,21 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
931 | public override void SubscribeEvents(int ms) | 933 | public override void SubscribeEvents(int ms) |
932 | { | 934 | { |
933 | m_eventsubscription = ms; | 935 | m_eventsubscription = ms; |
936 | m_cureventsubscription = 0; | ||
937 | if (CollisionEventsThisFrame == null) | ||
938 | CollisionEventsThisFrame = new CollisionEventUpdate(); | ||
939 | SentEmptyCollisionsEvent = false; | ||
934 | _parent_scene.AddCollisionEventReporting(this); | 940 | _parent_scene.AddCollisionEventReporting(this); |
935 | } | 941 | } |
936 | 942 | ||
937 | public override void UnSubscribeEvents() | 943 | public override void UnSubscribeEvents() |
938 | { | 944 | { |
939 | _parent_scene.RemoveCollisionEventReporting(this); | 945 | _parent_scene.RemoveCollisionEventReporting(this); |
946 | if (CollisionEventsThisFrame != null) | ||
947 | { | ||
948 | CollisionEventsThisFrame.Clear(); | ||
949 | CollisionEventsThisFrame = null; | ||
950 | } | ||
940 | m_eventsubscription = 0; | 951 | m_eventsubscription = 0; |
941 | } | 952 | } |
942 | 953 | ||
@@ -944,7 +955,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
944 | { | 955 | { |
945 | if (CollisionEventsThisFrame == null) | 956 | if (CollisionEventsThisFrame == null) |
946 | CollisionEventsThisFrame = new CollisionEventUpdate(); | 957 | CollisionEventsThisFrame = new CollisionEventUpdate(); |
947 | |||
948 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | 958 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); |
949 | } | 959 | } |
950 | 960 | ||
@@ -953,14 +963,34 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
953 | if (CollisionEventsThisFrame == null) | 963 | if (CollisionEventsThisFrame == null) |
954 | return; | 964 | return; |
955 | 965 | ||
956 | base.SendCollisionUpdate(CollisionEventsThisFrame); | 966 | if (m_cureventsubscription < m_eventsubscription) |
967 | return; | ||
957 | 968 | ||
958 | if (CollisionEventsThisFrame.m_objCollisionList.Count == 0) | 969 | m_cureventsubscription = 0; |
959 | CollisionEventsThisFrame = null; | 970 | |
960 | else | 971 | int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; |
961 | CollisionEventsThisFrame = new CollisionEventUpdate(); | 972 | |
973 | if (!SentEmptyCollisionsEvent || ncolisions > 0) | ||
974 | { | ||
975 | base.SendCollisionUpdate(CollisionEventsThisFrame); | ||
976 | |||
977 | if (ncolisions == 0) | ||
978 | SentEmptyCollisionsEvent = true; | ||
979 | else | ||
980 | { | ||
981 | SentEmptyCollisionsEvent = false; | ||
982 | CollisionEventsThisFrame.Clear(); | ||
983 | } | ||
984 | } | ||
962 | } | 985 | } |
963 | 986 | ||
987 | internal void AddCollisionFrameTime(int t) | ||
988 | { | ||
989 | // protect it from overflow crashing | ||
990 | if (m_cureventsubscription + t >= int.MaxValue) | ||
991 | m_cureventsubscription = 0; | ||
992 | m_cureventsubscription += t; | ||
993 | } | ||
964 | public override bool SubscribedEvents() | 994 | public override bool SubscribedEvents() |
965 | { | 995 | { |
966 | if (m_eventsubscription > 0) | 996 | if (m_eventsubscription > 0) |