Restore exact Morrowind gravity
This commit is contained in:
@@ -936,7 +936,7 @@ namespace MWClass
|
||||
if (stats.getStance(MWMechanics::CreatureStats::Stance_Run))
|
||||
x *= gmst.fJumpRunMultiplier->mValue.getFloat();
|
||||
x *= stats.getFatigueTerm();
|
||||
x -= -Constants::GravityConst * Constants::UnitsPerMeter;
|
||||
x -= -Constants::GravityUnits;
|
||||
x /= 3.0f;
|
||||
|
||||
return x;
|
||||
|
||||
@@ -430,7 +430,7 @@ namespace MWPhysics
|
||||
actor.mInertia = osg::Vec3f(0.f, 0.f, 0.f);
|
||||
else
|
||||
{
|
||||
actor.mInertia.z() -= time * Constants::GravityConst * Constants::UnitsPerMeter;
|
||||
actor.mInertia.z() -= time * Constants::GravityUnits;
|
||||
if (actor.mInertia.z() < 0)
|
||||
actor.mInertia.z() *= actor.mSlowFall;
|
||||
if (actor.mSlowFall < 1.f)
|
||||
|
||||
@@ -569,8 +569,7 @@ namespace MWWorld
|
||||
continue;
|
||||
// gravity constant - must be way lower than the gravity affecting actors, since we're not
|
||||
// simulating aerodynamics at all
|
||||
projectileState.mVelocity
|
||||
-= osg::Vec3f(0, 0, Constants::GravityConst * Constants::UnitsPerMeter * 0.1f) * duration;
|
||||
projectileState.mVelocity -= osg::Vec3f(0, 0, Constants::GravityUnits * 0.1f) * duration;
|
||||
|
||||
projectile->setVelocity(projectileState.mVelocity);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace Constants
|
||||
{
|
||||
|
||||
// The game uses 64 units per yard
|
||||
constexpr float UnitsPerYard = 64.0f;
|
||||
constexpr float UnitsPerMeter = 69.99125109f;
|
||||
constexpr float UnitsPerFoot = 21.33333333f;
|
||||
|
||||
@@ -14,12 +15,13 @@ namespace Constants
|
||||
constexpr float SoundSpeedInAir = 343.3f;
|
||||
constexpr float SoundSpeedUnderwater = 1484.0f;
|
||||
|
||||
// Gravity constant in m/sec^2
|
||||
// Note: 8.96 m/sec^2 = 9.8 yards/sec^2
|
||||
// Standard gravity in m/sec^2
|
||||
// Probably original engine's developers just forgot
|
||||
// that their engine uses yards instead of meters
|
||||
// and used standard gravity value as it is
|
||||
constexpr float GravityConst = 8.96f;
|
||||
// and used standard gravity value as it is,
|
||||
// so the game's gravity is 9.8 yards/sec^2
|
||||
constexpr float GravityMetric = 9.8f;
|
||||
constexpr float GravityUnits = GravityMetric * UnitsPerYard;
|
||||
|
||||
// Size of one exterior cell in game units
|
||||
constexpr int CellSizeInUnits = 8192;
|
||||
|
||||
Reference in New Issue
Block a user