Browse Source

a few more nan asserts

David Rose 18 years ago
parent
commit
5e149d9694
2 changed files with 10 additions and 0 deletions
  1. 9 0
      panda/src/physics/linearEulerIntegrator.cxx
  2. 1 0
      panda/src/physics/linearForce.cxx

+ 9 - 0
panda/src/physics/linearEulerIntegrator.cxx

@@ -66,6 +66,12 @@ child_integrate(Physical *physical,
   // otherwise your transforms will be VERY bad.
   precompute_linear_matrices(physical, forces);
   const MatrixVector &matrices = get_precomputed_linear_matrices();
+#ifndef NDEBUG
+  MatrixVector::const_iterator mi;
+  for (mi = matrices.begin(); mi != matrices.end(); ++mi) {
+    nassertv(!(*mi).is_nan());
+  }
+#endif  // NDEBUG
 
   // Get the greater of the local or global viscosity:
   float viscosityDamper=1.0f-physical->get_viscosity();
@@ -148,13 +154,16 @@ child_integrate(Physical *physical,
 
       // go from force space to object space
       f = cur_force->get_vector(current_object) * matrices[index++];
+      nassertv(!f.is_nan());
 
       physics_spam("child_integrate "<<f);
       // tally it into the accum vectors
       if (cur_force->get_mass_dependent() == true) {
         md_accum_vec += f;
+        nassertv(!md_accum_vec.is_nan());
       } else {
         non_md_accum_vec += f;
+        nassertv(!non_md_accum_vec.is_nan());
       }
     }
 

+ 1 - 0
panda/src/physics/linearForce.cxx

@@ -68,6 +68,7 @@ LinearForce::
 LVector3f LinearForce::
 get_vector(const PhysicsObject *po) {
   LVector3f child_vector = get_child_vector(po) * _amplitude;
+  nassertr(!child_vector.is_nan(), LVector3f::zero());
 
   if (_x_mask == false)
     child_vector[0] = 0.0f;