mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-28 23:36:41 +00:00
Merge branch 'spawn_fix' into 'master'
Fix #6173 Closes #6173 See merge request OpenMW/openmw!1046
This commit is contained in:
commit
2eea590762
4 changed files with 12 additions and 10 deletions
|
@ -19,8 +19,8 @@ namespace MWPhysics
|
|||
{
|
||||
|
||||
|
||||
Actor::Actor(const MWWorld::Ptr& ptr, const Resource::BulletShape* shape, PhysicsTaskScheduler* scheduler)
|
||||
: mStandingOnPtr(nullptr), mCanWaterWalk(false), mWalkingOnWater(false)
|
||||
Actor::Actor(const MWWorld::Ptr& ptr, const Resource::BulletShape* shape, PhysicsTaskScheduler* scheduler, bool canWaterWalk)
|
||||
: mStandingOnPtr(nullptr), mCanWaterWalk(canWaterWalk), mWalkingOnWater(false)
|
||||
, mCollisionObject(nullptr), mMeshTranslation(shape->mCollisionBox.center), mHalfExtents(shape->mCollisionBox.extents)
|
||||
, mVelocity(0,0,0), mStuckFrames(0), mLastStuckPosition{0, 0, 0}
|
||||
, mForce(0.f, 0.f, 0.f), mOnGround(true), mOnSlope(false)
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace MWPhysics
|
|||
class Actor final : public PtrHolder
|
||||
{
|
||||
public:
|
||||
Actor(const MWWorld::Ptr& ptr, const Resource::BulletShape* shape, PhysicsTaskScheduler* scheduler);
|
||||
Actor(const MWWorld::Ptr& ptr, const Resource::BulletShape* shape, PhysicsTaskScheduler* scheduler, bool canWaterWalk);
|
||||
~Actor() override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -688,7 +688,15 @@ namespace MWPhysics
|
|||
if (!shape)
|
||||
return;
|
||||
|
||||
auto actor = std::make_shared<Actor>(ptr, shape, mTaskScheduler.get());
|
||||
// check if Actor should spawn above water
|
||||
const MWMechanics::MagicEffects& effects = ptr.getClass().getCreatureStats(ptr).getMagicEffects();
|
||||
const bool canWaterWalk = effects.get(ESM::MagicEffect::WaterWalking).getMagnitude() > 0;
|
||||
|
||||
auto actor = std::make_shared<Actor>(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));
|
||||
}
|
||||
|
||||
|
|
|
@ -486,12 +486,6 @@ namespace MWWorld
|
|||
|
||||
const auto player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
// By default the player 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);
|
||||
}
|
||||
|
||||
navigator->update(player.getRefData().getPosition().asVec3());
|
||||
|
||||
if (!cell->isExterior() && !(cell->getCell()->mData.mFlags & ESM::Cell::QuasiEx))
|
||||
|
|
Loading…
Reference in a new issue