aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2009-03-30 14:10:24 +0000
committerTeravus Ovares2009-03-30 14:10:24 +0000
commit6522b4f5d4167f5f92683758f7959f70a3e73dd2 (patch)
tree63710a047b66c057889a093d384ee4f738bc6b02 /OpenSim/Region
parentAdd PickInfoReply packet. (diff)
downloadopensim-SC_OLD-6522b4f5d4167f5f92683758f7959f70a3e73dd2.zip
opensim-SC_OLD-6522b4f5d4167f5f92683758f7959f70a3e73dd2.tar.gz
opensim-SC_OLD-6522b4f5d4167f5f92683758f7959f70a3e73dd2.tar.bz2
opensim-SC_OLD-6522b4f5d4167f5f92683758f7959f70a3e73dd2.tar.xz
* Fixing thread safety of avatar adding and removing from the Physics Scene in the ODEPlugin
* This may help one of the symptoms or mantis 3363 , however it probably won't solve the occasional NonFinite Avatar Position detected.. issues that some people see. That is probably an entirely different issue(NaN).
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs1
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs31
3 files changed, 29 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 1808fa0..bf8ca0e 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -982,12 +982,14 @@ namespace OpenSim.Region.Physics.OdePlugin
982 + (Amotor!=IntPtr.Zero ? "Amotor ":"") ); 982 + (Amotor!=IntPtr.Zero ? "Amotor ":"") );
983 } 983 }
984 AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor); 984 AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor);
985 985
986 _parent_scene.geom_name_map[Shell] = m_name; 986 _parent_scene.geom_name_map[Shell] = m_name;
987 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; 987 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
988 _parent_scene.AddCharacter(this);
988 } 989 }
989 else 990 else
990 { 991 {
992 _parent_scene.RemoveCharacter(this);
991 // destroy avatar capsule and related ODE data 993 // destroy avatar capsule and related ODE data
992 994
993 // Kill the Amotor 995 // Kill the Amotor
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index e42c711..9e65dd8 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -1365,6 +1365,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1365 // Don't need to re-enable body.. it's done in SetMesh 1365 // Don't need to re-enable body.. it's done in SetMesh
1366 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical); 1366 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical);
1367 // createmesh returns null when it's a shape that isn't a cube. 1367 // createmesh returns null when it's a shape that isn't a cube.
1368 m_log.Debug(m_localID);
1368 } 1369 }
1369 } 1370 }
1370 1371
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 732d99b..e3ac668 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1339,20 +1339,39 @@ namespace OpenSim.Region.Physics.OdePlugin
1339 OdeCharacter newAv = new OdeCharacter(avName, this, pos, ode, size, avPIDD, avPIDP, avCapRadius, avStandupTensor, avDensity, avHeightFudgeFactor, avMovementDivisorWalk, avMovementDivisorRun); 1339 OdeCharacter newAv = new OdeCharacter(avName, this, pos, ode, size, avPIDD, avPIDP, avCapRadius, avStandupTensor, avDensity, avHeightFudgeFactor, avMovementDivisorWalk, avMovementDivisorRun);
1340 newAv.Flying = isFlying; 1340 newAv.Flying = isFlying;
1341 newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset; 1341 newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset;
1342 _characters.Add(newAv); 1342
1343 return newAv; 1343 return newAv;
1344 } 1344 }
1345 1345
1346 public override void RemoveAvatar(PhysicsActor actor) 1346 public void AddCharacter(OdeCharacter chr)
1347 { 1347 {
1348 lock (OdeLock) 1348 lock (_characters)
1349 { 1349 {
1350 //m_log.Debug("[PHYSICS]:ODELOCK"); 1350 if (!_characters.Contains(chr))
1351 ((OdeCharacter) actor).Destroy(); 1351 {
1352 _characters.Remove((OdeCharacter) actor); 1352 _characters.Add(chr);
1353 }
1353 } 1354 }
1354 } 1355 }
1355 1356
1357 public void RemoveCharacter(OdeCharacter chr)
1358 {
1359 lock (_characters)
1360 {
1361 if (_characters.Contains(chr))
1362 {
1363 _characters.Remove(chr);
1364 }
1365 }
1366 }
1367
1368 public override void RemoveAvatar(PhysicsActor actor)
1369 {
1370 //m_log.Debug("[PHYSICS]:ODELOCK");
1371 ((OdeCharacter) actor).Destroy();
1372
1373 }
1374
1356 private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, 1375 private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
1357 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) 1376 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
1358 { 1377 {