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:
parent
23e279c23e
commit
63bf4bf868
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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 |
|
||||
|
Loading…
x
Reference in New Issue
Block a user