aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-04 23:12:01 +0000
committerJustin Clark-Casey (justincc)2011-11-04 23:12:01 +0000
commitccca6ba93527d5a7a9a2a95324f3abc26e161f31 (patch)
treeea00371034a539074425108ff0844a30e8c91463 /OpenSim/Region/Physics
parentRename ForEachAvatar back to ForEachScenePresence. The other changes (diff)
downloadopensim-SC_OLD-ccca6ba93527d5a7a9a2a95324f3abc26e161f31.zip
opensim-SC_OLD-ccca6ba93527d5a7a9a2a95324f3abc26e161f31.tar.gz
opensim-SC_OLD-ccca6ba93527d5a7a9a2a95324f3abc26e161f31.tar.bz2
opensim-SC_OLD-ccca6ba93527d5a7a9a2a95324f3abc26e161f31.tar.xz
Stop llPushObject() from causing problems by adding force via a taint rather than directly.
This isn't a perfect solution since there can be a race between the taint processing and taint setting, as force needs to be reset after processing. Needs careful locking in the future.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs27
1 files changed, 25 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index f93d7ba..19d87c2 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -100,7 +100,14 @@ namespace OpenSim.Region.Physics.OdePlugin
100 private bool m_hackSentFall = false; 100 private bool m_hackSentFall = false;
101 private bool m_hackSentFly = false; 101 private bool m_hackSentFly = false;
102 private int m_requestedUpdateFrequency = 0; 102 private int m_requestedUpdateFrequency = 0;
103 private Vector3 m_taintPosition = Vector3.Zero; 103 private Vector3 m_taintPosition;
104
105 /// <summary>
106 /// Hold set forces so we can process them outside physics calculations. This prevents race conditions if we set force
107 /// while calculatios are going on
108 /// </summary>
109 private Vector3 m_taintForce;
110
104 internal uint m_localID = 0; 111 internal uint m_localID = 0;
105 // taints and their non-tainted counterparts 112 // taints and their non-tainted counterparts
106 private bool m_isPhysical = false; // the current physical status 113 private bool m_isPhysical = false; // the current physical status
@@ -832,7 +839,10 @@ namespace OpenSim.Region.Physics.OdePlugin
832 { 839 {
833 m_pidControllerActive = false; 840 m_pidControllerActive = false;
834 force *= 100f; 841 force *= 100f;
835 doForce(force); 842 m_taintForce += force;
843 _parent_scene.AddPhysicsActorTaint(this);
844
845 //doForce(force);
836 // If uncommented, things get pushed off world 846 // If uncommented, things get pushed off world
837 // 847 //
838 // m_log.Debug("Push!"); 848 // m_log.Debug("Push!");
@@ -1250,6 +1260,19 @@ namespace OpenSim.Region.Physics.OdePlugin
1250 } 1260 }
1251 } 1261 }
1252 1262
1263 if (m_taintForce != Vector3.Zero)
1264 {
1265 if (Body != IntPtr.Zero)
1266 {
1267 // FIXME: This is not a good solution since it's subject to a race condition if a force is another
1268 // thread sets a new force while we're in this loop (since it could be obliterated by
1269 // m_taintForce = Vector3.Zero. Need to lock ProcessTaints() when we set a new tainted force.
1270 doForce(m_taintForce);
1271 }
1272
1273 m_taintForce = Vector3.Zero;
1274 }
1275
1253 if (m_taintTargetVelocity != _target_velocity) 1276 if (m_taintTargetVelocity != _target_velocity)
1254 _target_velocity = m_taintTargetVelocity; 1277 _target_velocity = m_taintTargetVelocity;
1255 1278