1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-29 13:20:35 +00:00

Solve 2 bugs in projectile movement simulation:

- properly initialize mSimulationPosition in the constructor. Unlucky thread scheduling can cause processHits to be called before the first simulation run, causing the projectile to vanish to whatever value the variable happens to contains.
- don't continue moving the projectile after a hit. The position would continue to be updated to some senseless value.
This commit is contained in:
Frederic Chardon 2021-12-29 15:11:48 +01:00
parent 23e279c23e
commit 63bf4bf868
2 changed files with 3 additions and 1 deletions

View File

@ -185,7 +185,8 @@ namespace
}
void operator()(MWPhysics::ProjectileSimulation& sim) const
{
MWPhysics::MovementSolver::move(sim.second, mPhysicsDt, mCollisionWorld);
if (sim.first->isActive())
MWPhysics::MovementSolver::move(sim.second, mPhysicsDt, mCollisionWorld);
}
};

View File

@ -33,6 +33,7 @@ Projectile::Projectile(const MWWorld::Ptr& caster, const osg::Vec3f& position, f
mPosition = position;
mPreviousPosition = position;
mSimulationPosition = position;
setCaster(caster);
const int collisionMask = CollisionType_World | CollisionType_HeightMap |