Implement water walking

This commit is contained in:
scrawl 2014-01-02 02:03:11 +01:00
parent 5b0a4c9424
commit 0f2b2fabdb

View file

@ -577,10 +577,28 @@ namespace MWWorld
float oldHeight = iter->first.getRefData().getPosition().pos[2];
bool waterCollision = false;
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects()
.get(ESM::MagicEffect::WaterWalking).mMagnitude
&& cell->hasWater()
&& !world->isUnderwater(iter->first.getCell(),
Ogre::Vector3(iter->first.getRefData().getPosition().pos)))
waterCollision = true;
btStaticPlaneShape planeShape(btVector3(0,0,1), waterlevel);
btCollisionObject object;
object.setCollisionShape(&planeShape);
if (waterCollision)
mEngine->dynamicsWorld->addCollisionObject(&object);
Ogre::Vector3 newpos = MovementSolver::move(iter->first, iter->second, mTimeAccum,
world->isFlying(iter->first),
waterlevel, mEngine);
if (waterCollision)
mEngine->dynamicsWorld->removeCollisionObject(&object);
float heightDiff = newpos.z - oldHeight;
if (heightDiff < 0)