diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index e24aa3500..fcb85900b 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include #include @@ -682,21 +681,6 @@ namespace MWPhysics auto actor = std::make_shared(ptr, shape, mTaskScheduler.get()); - if (ptr == MWMechanics::getPlayer()) - { - osg::Vec3f offset = actor->getCollisionObjectPosition() - ptr.getRefData().getPosition().asVec3(); - std::cout << "DEBUG Player position: " << actor->getPosition() << std::endl; - auto terrainHeight = std::max(0.f, MWBase::Environment::get().getWorld()->getTerrainHeightAt(actor->getPosition())); - std::cout << "DEBUG terrain height " << terrainHeight << std::endl; - ActorTracer tracer; - tracer.findGround(actor.get(), actor->getPosition() + offset, actor->getPosition() + offset - osg::Vec3f(0, 0, 100.f), mCollisionWorld.get()); - std::cout << "DEBUG mFraction " << tracer.mFraction << std::endl; // it seems that player is loaded before the cell so we can't find the ground. - - std::cout << "DEBUG calculation :: " << actor->getPosition().z() - terrainHeight << std::endl; - if (actor->getPosition().z() - terrainHeight > 300.f) - actor->setOnGround(false); - } - mActors.emplace(ptr, std::move(actor)); } diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 427ee3aa8..ac01c8893 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -447,11 +447,14 @@ namespace MWWorld mPhysics->disableWater(); const auto player = MWBase::Environment::get().getWorld()->getPlayerPtr(); + if (player.getCell() == cell) { + mPhysics->traceDown(player, player.getRefData().getPosition().asVec3(), 10.f); + } + navigator->update(player.getRefData().getPosition().asVec3()); if (!cell->isExterior() && !(cell->getCell()->mData.mFlags & ESM::Cell::QuasiEx)) { - mRendering.configureAmbient(cell->getCell()); } }