mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 21:45:33 +00:00
Fix standing actors logic:
it is updated in the solver only if the actor is standing on "something". The ground is not "something", so in case the actor goes from standing on an object to the standing on the ground, this change was not taken into account. Clear the value before the simulation to solve this problem.
This commit is contained in:
parent
7d16b6f26c
commit
2916a9462e
2 changed files with 9 additions and 4 deletions
|
@ -678,10 +678,10 @@ namespace MWPhysics
|
|||
|
||||
mTimeAccum -= numSteps * mPhysicsDt;
|
||||
|
||||
return mTaskScheduler->moveActors(numSteps, mTimeAccum, prepareFrameData(), mStandingCollisions, skipSimulation);
|
||||
return mTaskScheduler->moveActors(numSteps, mTimeAccum, prepareFrameData(numSteps), mStandingCollisions, skipSimulation);
|
||||
}
|
||||
|
||||
std::vector<ActorFrameData> PhysicsSystem::prepareFrameData()
|
||||
std::vector<ActorFrameData> PhysicsSystem::prepareFrameData(int numSteps)
|
||||
{
|
||||
std::vector<ActorFrameData> actorsFrameData;
|
||||
actorsFrameData.reserve(mMovementQueue.size());
|
||||
|
@ -723,7 +723,12 @@ namespace MWPhysics
|
|||
// Slow fall reduces fall speed by a factor of (effect magnitude / 200)
|
||||
const float slowFall = 1.f - std::max(0.f, std::min(1.f, effects.get(ESM::MagicEffect::SlowFall).getMagnitude() * 0.005f));
|
||||
|
||||
actorsFrameData.emplace_back(std::move(physicActor), character, mStandingCollisions[character], moveToWaterSurface, movement, slowFall, waterlevel);
|
||||
// Ue current value only if we don't advance the simulation. Otherwise we might get a stale value.
|
||||
MWWorld::Ptr standingOn;
|
||||
if (numSteps == 0)
|
||||
standingOn = mStandingCollisions[character];
|
||||
|
||||
actorsFrameData.emplace_back(std::move(physicActor), character, standingOn, moveToWaterSurface, movement, slowFall, waterlevel);
|
||||
}
|
||||
mMovementQueue.clear();
|
||||
return actorsFrameData;
|
||||
|
|
|
@ -237,7 +237,7 @@ namespace MWPhysics
|
|||
|
||||
void updateWater();
|
||||
|
||||
std::vector<ActorFrameData> prepareFrameData();
|
||||
std::vector<ActorFrameData> prepareFrameData(int numSteps);
|
||||
|
||||
osg::ref_ptr<SceneUtil::UnrefQueue> mUnrefQueue;
|
||||
|
||||
|
|
Loading…
Reference in a new issue