diff options
author | Diva Canto | 2009-10-10 06:36:10 -0700 |
---|---|---|
committer | Diva Canto | 2009-10-10 06:36:10 -0700 |
commit | 01783877ec3bf1f0adff6801894e5786f1312284 (patch) | |
tree | c430883e7dfc3a3e3b56d60d6adce5688a409142 /OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |
parent | Use Util.UTF8 instead of creating a new heap object every time. (diff) | |
parent | Fix selling objects (diff) | |
download | opensim-SC_OLD-01783877ec3bf1f0adff6801894e5786f1312284.zip opensim-SC_OLD-01783877ec3bf1f0adff6801894e5786f1312284.tar.gz opensim-SC_OLD-01783877ec3bf1f0adff6801894e5786f1312284.tar.bz2 opensim-SC_OLD-01783877ec3bf1f0adff6801894e5786f1312284.tar.xz |
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODECharacter.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 18 |
1 files changed, 16 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 | } |