|
|
|
@ -108,7 +108,7 @@ namespace MWWorld
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Ogre::Vector3 move(const MWWorld::Ptr &ptr, const Ogre::Vector3 &movement, float time,
|
|
|
|
|
bool isFlying, float waterlevel, OEngine::Physic::PhysicEngine *engine)
|
|
|
|
|
bool isFlying, float waterlevel, float slowFall, OEngine::Physic::PhysicEngine *engine)
|
|
|
|
|
{
|
|
|
|
|
const ESM::Position &refpos = ptr.getRefData().getPosition();
|
|
|
|
|
Ogre::Vector3 position(refpos.pos);
|
|
|
|
@ -229,7 +229,10 @@ namespace MWWorld
|
|
|
|
|
physicActor->setInertialForce(Ogre::Vector3(0.0f));
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
inertia.z += time*-627.2f;
|
|
|
|
|
float diff = time*-627.2f;
|
|
|
|
|
if (inertia.z < 0)
|
|
|
|
|
diff *= slowFall;
|
|
|
|
|
inertia.z += diff;
|
|
|
|
|
physicActor->setInertialForce(inertia);
|
|
|
|
|
}
|
|
|
|
|
physicActor->setOnGround(isOnGround);
|
|
|
|
@ -577,9 +580,10 @@ namespace MWWorld
|
|
|
|
|
|
|
|
|
|
float oldHeight = iter->first.getRefData().getPosition().pos[2];
|
|
|
|
|
|
|
|
|
|
const MWMechanics::MagicEffects& effects = iter->first.getClass().getCreatureStats(iter->first).getMagicEffects();
|
|
|
|
|
|
|
|
|
|
bool waterCollision = false;
|
|
|
|
|
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects()
|
|
|
|
|
.get(ESM::MagicEffect::WaterWalking).mMagnitude
|
|
|
|
|
if (effects.get(ESM::MagicEffect::WaterWalking).mMagnitude
|
|
|
|
|
&& cell->hasWater()
|
|
|
|
|
&& !world->isUnderwater(iter->first.getCell(),
|
|
|
|
|
Ogre::Vector3(iter->first.getRefData().getPosition().pos)))
|
|
|
|
@ -592,9 +596,12 @@ namespace MWWorld
|
|
|
|
|
if (waterCollision)
|
|
|
|
|
mEngine->dynamicsWorld->addCollisionObject(&object);
|
|
|
|
|
|
|
|
|
|
// 100 points of slowfall reduce gravity by 90% (this is just a guess)
|
|
|
|
|
float slowFall = 1-std::min(std::max(0.f, (effects.get(ESM::MagicEffect::SlowFall).mMagnitude / 100.f) * 0.9f), 0.9f);
|
|
|
|
|
|
|
|
|
|
Ogre::Vector3 newpos = MovementSolver::move(iter->first, iter->second, mTimeAccum,
|
|
|
|
|
world->isFlying(iter->first),
|
|
|
|
|
waterlevel, mEngine);
|
|
|
|
|
waterlevel, slowFall, mEngine);
|
|
|
|
|
|
|
|
|
|
if (waterCollision)
|
|
|
|
|
mEngine->dynamicsWorld->removeCollisionObject(&object);
|
|
|
|
|