From a8aad71d03bb8ccbb66b9ab78c5e2e018eb8d868 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 13 Mar 2009 11:01:11 +0000 Subject: [PATCH] Fixed for division by zero issue. --- src/osgParticle/FluidProgram.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osgParticle/FluidProgram.cpp b/src/osgParticle/FluidProgram.cpp index 76dddeae0..f5b06c18d 100644 --- a/src/osgParticle/FluidProgram.cpp +++ b/src/osgParticle/FluidProgram.cpp @@ -40,11 +40,11 @@ void osgParticle::FluidProgram::execute(double dt) osg::Vec3 wind_force = - relative_wind * Area * (_viscosityCoefficient + _densityCoefficient*relative_wind.length()); osg::Vec3 wind_accel = wind_force * particle->getMassInv(); - double critical_dt2 = relative_wind.length2()/wind_accel.length2(); double compenstated_dt = dt; - if (critical_dt2 < dt*dt) + if (relative_wind.length2() < dt*dt*wind_accel.length2()) { // osg::notify(osg::NOTICE)<<"** Could be critical: dt="<