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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user