aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-21 21:04:24 +0000
committerJustin Clark-Casey (justincc)2011-11-21 21:04:24 +0000
commit7480f2fd0e5482d366890b34d4aca72c887e02c3 (patch)
treed0ff0bc3decfc18907fbc77d2579c95578f3ec67 /OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
parentsimplify operation of OdeScene._perloopContact (diff)
downloadopensim-SC-7480f2fd0e5482d366890b34d4aca72c887e02c3.zip
opensim-SC-7480f2fd0e5482d366890b34d4aca72c887e02c3.tar.gz
opensim-SC-7480f2fd0e5482d366890b34d4aca72c887e02c3.tar.bz2
opensim-SC-7480f2fd0e5482d366890b34d4aca72c887e02c3.tar.xz
Restore defects list. In hindsight, the reason for this is becuase we can't remove the character whilst iterating over the list.
This commit also removes locking on OdeScene._characters since code is single threaded
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODECharacter.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs27
1 files changed, 15 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 5a7626e..cfe64f2 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -862,11 +862,10 @@ namespace OpenSim.Region.Physics.OdePlugin
862 /// Called from Simulate 862 /// Called from Simulate
863 /// This is the avatar's movement control + PID Controller 863 /// This is the avatar's movement control + PID Controller
864 /// </summary> 864 /// </summary>
865 /// <remarks> 865 /// <param name="defects">The character will be added to this list if there is something wrong (non-finite
866 /// This routine will remove the character from the physics scene if it detects something wrong (non-finite
867 /// position or velocity). 866 /// position or velocity).
868 /// </remarks> 867 /// </param>
869 internal void Move() 868 internal void Move(List<OdeCharacter> defects)
870 { 869 {
871 // no lock; for now it's only called from within Simulate() 870 // no lock; for now it's only called from within Simulate()
872 871
@@ -891,8 +890,7 @@ namespace OpenSim.Region.Physics.OdePlugin
891 "[ODE CHARACTER]: Avatar position of {0} for {1} is non-finite! Removing from physics scene.", 890 "[ODE CHARACTER]: Avatar position of {0} for {1} is non-finite! Removing from physics scene.",
892 localPos, Name); 891 localPos, Name);
893 892
894 _parent_scene.RemoveCharacter(this); 893 defects.Add(this);
895 DestroyOdeStructures();
896 894
897 return; 895 return;
898 } 896 }
@@ -1031,15 +1029,19 @@ namespace OpenSim.Region.Physics.OdePlugin
1031 "[ODE CHARACTER]: Got a NaN force vector {0} in Move() for {1}. Removing character from physics scene.", 1029 "[ODE CHARACTER]: Got a NaN force vector {0} in Move() for {1}. Removing character from physics scene.",
1032 vec, Name); 1030 vec, Name);
1033 1031
1034 _parent_scene.RemoveCharacter(this); 1032 defects.Add(this);
1035 DestroyOdeStructures(); 1033
1034 return;
1036 } 1035 }
1037 } 1036 }
1038 1037
1039 /// <summary> 1038 /// <summary>
1040 /// Updates the reported position and velocity. This essentially sends the data up to ScenePresence. 1039 /// Updates the reported position and velocity. This essentially sends the data up to ScenePresence.
1041 /// </summary> 1040 /// </summary>
1042 internal void UpdatePositionAndVelocity() 1041 /// <param name="defects">The character will be added to this list if there is something wrong (non-finite
1042 /// position or velocity).
1043 /// </param>
1044 internal void UpdatePositionAndVelocity(List<OdeCharacter> defects)
1043 { 1045 {
1044 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! 1046 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
1045 d.Vector3 newPos; 1047 d.Vector3 newPos;
@@ -1050,11 +1052,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1050 catch (NullReferenceException) 1052 catch (NullReferenceException)
1051 { 1053 {
1052 bad = true; 1054 bad = true;
1053 _parent_scene.RemoveCharacter(this); 1055 defects.Add(this);
1054 DestroyOdeStructures();
1055 newPos = new d.Vector3(_position.X, _position.Y, _position.Z); 1056 newPos = new d.Vector3(_position.X, _position.Y, _position.Z);
1056 base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem! 1057 base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
1057 m_log.WarnFormat("[ODE CHARACTER]: Avatar Null reference for Avatar {0}, physical actor {1}", Name, m_uuid); 1058 m_log.WarnFormat("[ODE CHARACTER]: Avatar Null reference for Avatar {0}, physical actor {1}", Name, m_uuid);
1059
1060 return;
1058 } 1061 }
1059 1062
1060 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) 1063 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
@@ -1134,7 +1137,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1134 /// <summary> 1137 /// <summary>
1135 /// Used internally to destroy the ODE structures associated with this character. 1138 /// Used internally to destroy the ODE structures associated with this character.
1136 /// </summary> 1139 /// </summary>
1137 private void DestroyOdeStructures() 1140 internal void DestroyOdeStructures()
1138 { 1141 {
1139 // destroy avatar capsule and related ODE data 1142 // destroy avatar capsule and related ODE data
1140 if (Amotor != IntPtr.Zero) 1143 if (Amotor != IntPtr.Zero)