From 713f612bdb7c2141256fcb5c5036cad545c05f08 Mon Sep 17 00:00:00 2001 From: fredzio Date: Fri, 13 Aug 2021 18:01:16 +0200 Subject: [PATCH] Partially revert !1046: the player is added before the scene exists, so we need to check again the grounded state, as it correctly was. --- apps/openmw/mwphysics/physicssystem.cpp | 3 --- apps/openmw/mwworld/scene.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 846f80ec64..abd4c79e7b 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -712,9 +712,6 @@ namespace MWPhysics auto actor = std::make_shared(ptr, shape, mTaskScheduler.get(), canWaterWalk); - // check if Actor is on the ground or in the air - traceDown(ptr, ptr.getRefData().getPosition().asVec3(), 10.f); - mActors.emplace(ptr, std::move(actor)); } diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 3de4940a37..2b7877938f 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -504,6 +504,12 @@ namespace MWWorld const auto player = MWBase::Environment::get().getWorld()->getPlayerPtr(); + // The player is loaded before the scene and by default it is grounded, with the scene fully loaded, we validate and correct this. + if (player.mCell == cell) // Only run once, during initial cell load. + { + mPhysics->traceDown(player, player.getRefData().getPosition().asVec3(), 10.f); + } + mNavigator.update(player.getRefData().getPosition().asVec3()); if (!cell->isExterior() && !(cell->getCell()->mData.mFlags & ESM::Cell::QuasiEx))