mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 18:09:39 +00:00
Don't apply 1.6 magic value to NiGravity decay factor (#5266)
This commit is contained in:
parent
2652b10b9c
commit
dcafe719a5
2 changed files with 5 additions and 6 deletions
|
@ -195,6 +195,7 @@
|
||||||
Bug #5249: Wandering NPCs start walking too soon after they hello
|
Bug #5249: Wandering NPCs start walking too soon after they hello
|
||||||
Bug #5250: Creatures display shield ground mesh instead of shield body part
|
Bug #5250: Creatures display shield ground mesh instead of shield body part
|
||||||
Bug #5255: "GetTarget, player" doesn't return 1 during NPC hello
|
Bug #5255: "GetTarget, player" doesn't return 1 during NPC hello
|
||||||
|
Bug #5266: Incorrect NiGravity decay implementation
|
||||||
Feature #1774: Handle AvoidNode
|
Feature #1774: Handle AvoidNode
|
||||||
Feature #2229: Improve pathfinding AI
|
Feature #2229: Improve pathfinding AI
|
||||||
Feature #3025: Analogue gamepad movement controls
|
Feature #3025: Analogue gamepad movement controls
|
||||||
|
|
|
@ -203,12 +203,12 @@ void GravityAffector::beginOperate(osgParticle::Program* program)
|
||||||
|
|
||||||
void GravityAffector::operate(osgParticle::Particle *particle, double dt)
|
void GravityAffector::operate(osgParticle::Particle *particle, double dt)
|
||||||
{
|
{
|
||||||
const float magic = 1.6f;
|
// Reverse-engineered value.
|
||||||
|
float decayFactor = 1.6f;
|
||||||
switch (mType)
|
switch (mType)
|
||||||
{
|
{
|
||||||
case Type_Wind:
|
case Type_Wind:
|
||||||
{
|
{
|
||||||
float decayFactor = 1.f;
|
|
||||||
if (mDecay != 0.f)
|
if (mDecay != 0.f)
|
||||||
{
|
{
|
||||||
osg::Plane gravityPlane(mCachedWorldDirection, mCachedWorldPosition);
|
osg::Plane gravityPlane(mCachedWorldDirection, mCachedWorldPosition);
|
||||||
|
@ -216,21 +216,19 @@ void GravityAffector::operate(osgParticle::Particle *particle, double dt)
|
||||||
decayFactor = std::exp(-1.f * mDecay * distance);
|
decayFactor = std::exp(-1.f * mDecay * distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
particle->addVelocity(mCachedWorldDirection * mForce * dt * decayFactor * magic);
|
particle->addVelocity(mCachedWorldDirection * mForce * dt * decayFactor);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Type_Point:
|
case Type_Point:
|
||||||
{
|
{
|
||||||
osg::Vec3f diff = mCachedWorldPosition - particle->getPosition();
|
osg::Vec3f diff = mCachedWorldPosition - particle->getPosition();
|
||||||
|
|
||||||
float decayFactor = 1.f;
|
|
||||||
if (mDecay != 0.f)
|
if (mDecay != 0.f)
|
||||||
decayFactor = std::exp(-1.f * mDecay * diff.length());
|
decayFactor = std::exp(-1.f * mDecay * diff.length());
|
||||||
|
|
||||||
diff.normalize();
|
diff.normalize();
|
||||||
|
|
||||||
particle->addVelocity(diff * mForce * dt * decayFactor * magic);
|
particle->addVelocity(diff * mForce * dt * decayFactor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue