aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorTeravus Ovares2009-04-07 16:41:07 +0000
committerTeravus Ovares2009-04-07 16:41:07 +0000
commitb326b55bcd7b794cb90c0df9337cc817db58f9a2 (patch)
treecbe83e72a67749f2c1cf24750dbbd42cdf54bfcb /OpenSim/Region/Physics
parent* Added a routine to check if a PhysicsVector and Quaternion is finite (diff)
downloadopensim-SC-b326b55bcd7b794cb90c0df9337cc817db58f9a2.zip
opensim-SC-b326b55bcd7b794cb90c0df9337cc817db58f9a2.tar.gz
opensim-SC-b326b55bcd7b794cb90c0df9337cc817db58f9a2.tar.bz2
opensim-SC-b326b55bcd7b794cb90c0df9337cc817db58f9a2.tar.xz
* Added finite testing to the character and object constructor
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs21
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs18
2 files changed, 35 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index c37b632..c160cda 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -133,11 +133,24 @@ namespace OpenSim.Region.Physics.OdePlugin
133 // ode = dode; 133 // ode = dode;
134 _velocity = new PhysicsVector(); 134 _velocity = new PhysicsVector();
135 _target_velocity = new PhysicsVector(); 135 _target_velocity = new PhysicsVector();
136 _position = pos;
137 136
138 m_taintPosition.X = pos.X; 137
139 m_taintPosition.Y = pos.Y; 138 if (PhysicsVector.isFinite(pos))
140 m_taintPosition.Z = pos.Z; 139 {
140 _position = pos;
141 m_taintPosition.X = pos.X;
142 m_taintPosition.Y = pos.Y;
143 m_taintPosition.Z = pos.Z;
144 }
145 else
146 {
147 _position = new PhysicsVector(128,128,parent_scene.GetTerrainHeightAtXY(128,128) + 10);
148 m_taintPosition.X = _position.X;
149 m_taintPosition.Y = _position.Y;
150 m_taintPosition.Z = _position.Z;
151 m_log.Warn("[PHYSICS]: Got NaN Position on Character Create");
152 }
153
141 154
142 _acceleration = new PhysicsVector(); 155 _acceleration = new PhysicsVector();
143 _parent_scene = parent_scene; 156 _parent_scene = parent_scene;
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index a55ae76..5e7ec37 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -173,6 +173,11 @@ namespace OpenSim.Region.Physics.OdePlugin
173 //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned); 173 //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);
174 ode = dode; 174 ode = dode;
175 _velocity = new PhysicsVector(); 175 _velocity = new PhysicsVector();
176 if (!PhysicsVector.isFinite(pos))
177 {
178 pos = new PhysicsVector(128, 128, parent_scene.GetTerrainHeightAtXY(128, 128) + 0.5f);
179 m_log.Warn("[PHYSICS]: Got nonFinite Object create Position");
180 }
176 _position = pos; 181 _position = pos;
177 m_taintposition = pos; 182 m_taintposition = pos;
178 PID_D = parent_scene.bodyPIDD; 183 PID_D = parent_scene.bodyPIDD;
@@ -185,6 +190,12 @@ namespace OpenSim.Region.Physics.OdePlugin
185 prim_geom = IntPtr.Zero; 190 prim_geom = IntPtr.Zero;
186 prev_geom = IntPtr.Zero; 191 prev_geom = IntPtr.Zero;
187 192
193 if (!PhysicsVector.isFinite(pos))
194 {
195 size = new PhysicsVector(0.5f, 0.5f, 0.5f);
196 m_log.Warn("[PHYSICS]: Got nonFinite Object create Size");
197 }
198
188 if (size.X <= 0) size.X = 0.01f; 199 if (size.X <= 0) size.X = 0.01f;
189 if (size.Y <= 0) size.Y = 0.01f; 200 if (size.Y <= 0) size.Y = 0.01f;
190 if (size.Z <= 0) size.Z = 0.01f; 201 if (size.Z <= 0) size.Z = 0.01f;
@@ -193,6 +204,13 @@ namespace OpenSim.Region.Physics.OdePlugin
193 m_taintsize = _size; 204 m_taintsize = _size;
194 _acceleration = new PhysicsVector(); 205 _acceleration = new PhysicsVector();
195 m_rotationalVelocity = PhysicsVector.Zero; 206 m_rotationalVelocity = PhysicsVector.Zero;
207
208 if (!QuaternionIsFinite(rotation))
209 {
210 rotation = Quaternion.Identity;
211 m_log.Warn("[PHYSICS]: Got nonFinite Object create Rotation");
212 }
213
196 _orientation = rotation; 214 _orientation = rotation;
197 m_taintrot = _orientation; 215 m_taintrot = _orientation;
198 _mesh = mesh; 216 _mesh = mesh;