From 84f300fdaf4bc08f8aaf67677fe681ce093cc78c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 28 Jan 2009 11:16:29 +0000 Subject: [PATCH] From Lionel Lagarde, removed accounting of local to world transform on the force vector as the particle velocity should already been in world coords. Fixing this addresses a bug where particles accelerated out of the scene rather than slowing down. --- src/osgParticle/FluidFrictionOperator.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osgParticle/FluidFrictionOperator.cpp b/src/osgParticle/FluidFrictionOperator.cpp index a53eb270b..89e550096 100644 --- a/src/osgParticle/FluidFrictionOperator.cpp +++ b/src/osgParticle/FluidFrictionOperator.cpp @@ -36,10 +36,14 @@ void osgParticle::FluidFrictionOperator::operate(Particle* P, double dt) float R = _coeff_A * r * vm + _coeff_B * r * r * vm * vm; osg::Vec3 Fr(-R * v.x(), -R * v.y(), -R * v.z()); - + +#if 0 + // Commenting out rotation of force vector rotation from local to world as the particle velocity itself + // should already be in world coords so shouldn't need rotating. if (_current_program->getReferenceFrame() == ModularProgram::RELATIVE_RF) { Fr = _current_program->rotateLocalToWorld(Fr); } +#endif // correct unwanted velocity increments osg::Vec3 dv = Fr * P->getMassInv() * dt;