Revert "Don't apply 1.6 magic value to NiGravity decay factor (#5266)"

pull/2685/head
Alexei Dobrohotov 5 years ago committed by GitHub
parent 10129252c8
commit 234fdfefb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -195,7 +195,6 @@
Bug #5249: Wandering NPCs start walking too soon after they hello
Bug #5250: Creatures display shield ground mesh instead of shield body part
Bug #5255: "GetTarget, player" doesn't return 1 during NPC hello
Bug #5266: Incorrect NiGravity decay implementation
Feature #1774: Handle AvoidNode
Feature #2229: Improve pathfinding AI
Feature #3025: Analogue gamepad movement controls

@ -203,12 +203,12 @@ void GravityAffector::beginOperate(osgParticle::Program* program)
void GravityAffector::operate(osgParticle::Particle *particle, double dt)
{
// Reverse-engineered value.
float decayFactor = 1.6f;
const float magic = 1.6f;
switch (mType)
{
case Type_Wind:
{
float decayFactor = 1.f;
if (mDecay != 0.f)
{
osg::Plane gravityPlane(mCachedWorldDirection, mCachedWorldPosition);
@ -216,19 +216,21 @@ void GravityAffector::operate(osgParticle::Particle *particle, double dt)
decayFactor = std::exp(-1.f * mDecay * distance);
}
particle->addVelocity(mCachedWorldDirection * mForce * dt * decayFactor);
particle->addVelocity(mCachedWorldDirection * mForce * dt * decayFactor * magic);
break;
}
case Type_Point:
{
osg::Vec3f diff = mCachedWorldPosition - particle->getPosition();
float decayFactor = 1.f;
if (mDecay != 0.f)
decayFactor = std::exp(-1.f * mDecay * diff.length());
diff.normalize();
particle->addVelocity(diff * mForce * dt * decayFactor);
particle->addVelocity(diff * mForce * dt * decayFactor * magic);
break;
}
}

Loading…
Cancel
Save