aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin
diff options
context:
space:
mode:
authorTeravus Ovares2009-04-14 01:57:35 +0000
committerTeravus Ovares2009-04-14 01:57:35 +0000
commitc2e75aecd1eba90d3a376896f1a798a4c9c58e6d (patch)
tree277760c63ec2af87374d62e2c3fd78a081e4be7a /OpenSim/Region/Physics/OdePlugin
parent* Set eol-style: native on J2KImage.cs (diff)
downloadopensim-SC_OLD-c2e75aecd1eba90d3a376896f1a798a4c9c58e6d.zip
opensim-SC_OLD-c2e75aecd1eba90d3a376896f1a798a4c9c58e6d.tar.gz
opensim-SC_OLD-c2e75aecd1eba90d3a376896f1a798a4c9c58e6d.tar.bz2
opensim-SC_OLD-c2e75aecd1eba90d3a376896f1a798a4c9c58e6d.tar.xz
* Commit a variety of fixes to bugs discovered while trying to fix the NaN singularity.
* WebStatsModule doesn't crash on restart. GodsModule doesn't crash when there is no Dialog Module. LLUDPServer doesn't crash when the Operation was Aborted. * ODEPlugin does 'Almost NaN' sanity checks. * ODEPlugin sacrifices NaN avatars to the NaN black hole to appease it and keep it from sucking the rest of the world in.
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs111
1 files changed, 100 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index c160cda..dae19c3 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -137,6 +137,14 @@ namespace OpenSim.Region.Physics.OdePlugin
137 137
138 if (PhysicsVector.isFinite(pos)) 138 if (PhysicsVector.isFinite(pos))
139 { 139 {
140 if (pos.Z > 9999999)
141 {
142 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
143 }
144 if (pos.Z < -90000)
145 {
146 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
147 }
140 _position = pos; 148 _position = pos;
141 m_taintPosition.X = pos.X; 149 m_taintPosition.X = pos.X;
142 m_taintPosition.Y = pos.Y; 150 m_taintPosition.Y = pos.Y;
@@ -396,6 +404,15 @@ namespace OpenSim.Region.Physics.OdePlugin
396 { 404 {
397 if (PhysicsVector.isFinite(value)) 405 if (PhysicsVector.isFinite(value))
398 { 406 {
407 if (value.Z > 9999999)
408 {
409 value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
410 }
411 if (value.Z < -90000)
412 {
413 value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
414 }
415
399 _position.X = value.X; 416 _position.X = value.X;
400 _position.Y = value.Y; 417 _position.Y = value.Y;
401 _position.Z = value.Z; 418 _position.Z = value.Z;
@@ -780,6 +797,41 @@ namespace OpenSim.Region.Physics.OdePlugin
780 } 797 }
781 //PidStatus = true; 798 //PidStatus = true;
782 799
800 d.Vector3 localpos = d.BodyGetPosition(Body);
801 PhysicsVector localPos = new PhysicsVector(localpos.X, localpos.Y, localpos.Z);
802 if (!PhysicsVector.isFinite(localPos))
803 {
804
805 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
806 _parent_scene.RemoveCharacter(this);
807 // destroy avatar capsule and related ODE data
808 if (Amotor != IntPtr.Zero)
809 {
810 // Kill the Amotor
811 d.JointDestroy(Amotor);
812 Amotor = IntPtr.Zero;
813 }
814 //kill the Geometry
815 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
816
817 if (Body != IntPtr.Zero)
818 {
819 //kill the body
820 d.BodyDestroy(Body);
821
822 Body = IntPtr.Zero;
823 }
824
825 if (Shell != IntPtr.Zero)
826 {
827 d.GeomDestroy(Shell);
828 _parent_scene.geom_name_map.Remove(Shell);
829 Shell = IntPtr.Zero;
830 }
831
832 return;
833 }
834
783 PhysicsVector vec = new PhysicsVector(); 835 PhysicsVector vec = new PhysicsVector();
784 d.Vector3 vel = d.BodyGetLinearVel(Body); 836 d.Vector3 vel = d.BodyGetLinearVel(Body);
785 float movementdivisor = 1f; 837 float movementdivisor = 1f;
@@ -901,6 +953,34 @@ namespace OpenSim.Region.Physics.OdePlugin
901 else 953 else
902 { 954 {
903 m_log.Warn("[PHYSICS]: Got a NaN force vector in Move()"); 955 m_log.Warn("[PHYSICS]: Got a NaN force vector in Move()");
956 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
957 _parent_scene.RemoveCharacter(this);
958 // destroy avatar capsule and related ODE data
959 if (Amotor != IntPtr.Zero)
960 {
961 // Kill the Amotor
962 d.JointDestroy(Amotor);
963 Amotor = IntPtr.Zero;
964 }
965 //kill the Geometry
966 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
967
968 if (Body != IntPtr.Zero)
969 {
970 //kill the body
971 d.BodyDestroy(Body);
972
973 Body = IntPtr.Zero;
974 }
975
976 if (Shell != IntPtr.Zero)
977 {
978 d.GeomDestroy(Shell);
979 _parent_scene.geom_name_map.Remove(Shell);
980 Shell = IntPtr.Zero;
981 }
982
983 return;
904 } 984 }
905 } 985 }
906 986
@@ -1044,21 +1124,30 @@ namespace OpenSim.Region.Physics.OdePlugin
1044 { 1124 {
1045 _parent_scene.RemoveCharacter(this); 1125 _parent_scene.RemoveCharacter(this);
1046 // destroy avatar capsule and related ODE data 1126 // destroy avatar capsule and related ODE data
1047 1127 if (Amotor != IntPtr.Zero)
1048 // Kill the Amotor 1128 {
1049 d.JointDestroy(Amotor); 1129 // Kill the Amotor
1050 Amotor = IntPtr.Zero; 1130 d.JointDestroy(Amotor);
1051 1131 Amotor = IntPtr.Zero;
1132 }
1052 //kill the Geometry 1133 //kill the Geometry
1053 _parent_scene.waitForSpaceUnlock(_parent_scene.space); 1134 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
1054 1135
1055 d.GeomDestroy(Shell); 1136 if (Body != IntPtr.Zero)
1056 _parent_scene.geom_name_map.Remove(Shell); 1137 {
1057 Shell = IntPtr.Zero; 1138 //kill the body
1139 d.BodyDestroy(Body);
1140
1141 Body = IntPtr.Zero;
1142 }
1143
1144 if (Shell != IntPtr.Zero)
1145 {
1146 d.GeomDestroy(Shell);
1147 _parent_scene.geom_name_map.Remove(Shell);
1148 Shell = IntPtr.Zero;
1149 }
1058 1150
1059 //kill the body
1060 d.BodyDestroy(Body);
1061 Body=IntPtr.Zero;
1062 } 1151 }
1063 1152
1064 m_isPhysical = m_tainted_isPhysical; 1153 m_isPhysical = m_tainted_isPhysical;