diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 1 |
2 files changed, 17 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index a00ba11..bd81d50 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -98,6 +98,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
98 | private bool m_alwaysRun = false; | 98 | private bool m_alwaysRun = false; |
99 | private bool m_hackSentFall = false; | 99 | private bool m_hackSentFall = false; |
100 | private bool m_hackSentFly = false; | 100 | private bool m_hackSentFly = false; |
101 | private int m_requestedUpdateFrequency = 0; | ||
101 | private PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0); | 102 | private PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0); |
102 | public uint m_localID = 0; | 103 | public uint m_localID = 0; |
103 | public bool m_returnCollisions = false; | 104 | public bool m_returnCollisions = false; |
@@ -1184,26 +1185,31 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1184 | 1185 | ||
1185 | public override void SubscribeEvents(int ms) | 1186 | public override void SubscribeEvents(int ms) |
1186 | { | 1187 | { |
1188 | m_requestedUpdateFrequency = ms; | ||
1187 | m_eventsubscription = ms; | 1189 | m_eventsubscription = ms; |
1188 | _parent_scene.addCollisionEventReporting(this); | 1190 | _parent_scene.addCollisionEventReporting(this); |
1189 | } | 1191 | } |
1190 | public override void UnSubscribeEvents() | 1192 | public override void UnSubscribeEvents() |
1191 | { | 1193 | { |
1192 | _parent_scene.remCollisionEventReporting(this); | 1194 | _parent_scene.remCollisionEventReporting(this); |
1195 | m_requestedUpdateFrequency = 0; | ||
1193 | m_eventsubscription = 0; | 1196 | m_eventsubscription = 0; |
1194 | } | 1197 | } |
1195 | public void AddCollisionEvent(uint CollidedWith, float depth) | 1198 | public void AddCollisionEvent(uint CollidedWith, float depth) |
1196 | { | 1199 | { |
1197 | if (m_eventsubscription > 0) | 1200 | if (m_eventsubscription > 0) |
1198 | CollisionEventsThisFrame.addCollider(CollidedWith,depth); | 1201 | { |
1202 | CollisionEventsThisFrame.addCollider(CollidedWith, depth); | ||
1203 | } | ||
1199 | } | 1204 | } |
1200 | 1205 | ||
1201 | public void SendCollisions() | 1206 | public void SendCollisions() |
1202 | { | 1207 | { |
1203 | if (m_eventsubscription > 0) | 1208 | if (m_eventsubscription > m_requestedUpdateFrequency) |
1204 | { | 1209 | { |
1205 | base.SendCollisionUpdate(CollisionEventsThisFrame); | 1210 | base.SendCollisionUpdate(CollisionEventsThisFrame); |
1206 | CollisionEventsThisFrame = new CollisionEventUpdate(); | 1211 | CollisionEventsThisFrame = new CollisionEventUpdate(); |
1212 | m_eventsubscription = 0; | ||
1207 | } | 1213 | } |
1208 | } | 1214 | } |
1209 | public override bool SubscribedEvents() | 1215 | public override bool SubscribedEvents() |
@@ -1309,5 +1315,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1309 | } | 1315 | } |
1310 | 1316 | ||
1311 | } | 1317 | } |
1318 | |||
1319 | internal void AddCollisionFrameTime(int p) | ||
1320 | { | ||
1321 | // protect it from overflow crashing | ||
1322 | if (m_eventsubscription + p >= int.MaxValue) | ||
1323 | m_eventsubscription = 0; | ||
1324 | m_eventsubscription += p; | ||
1325 | } | ||
1312 | } | 1326 | } |
1313 | } | 1327 | } |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index f5ab1de..083b7db 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -2928,6 +2928,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2928 | { | 2928 | { |
2929 | case ActorTypes.Agent: | 2929 | case ActorTypes.Agent: |
2930 | OdeCharacter cobj = (OdeCharacter)obj; | 2930 | OdeCharacter cobj = (OdeCharacter)obj; |
2931 | cobj.AddCollisionFrameTime(100); | ||
2931 | cobj.SendCollisions(); | 2932 | cobj.SendCollisions(); |
2932 | break; | 2933 | break; |
2933 | case ActorTypes.Prim: | 2934 | case ActorTypes.Prim: |