diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index 3c0e67729b..0d6cef565d 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -784,6 +784,13 @@ namespace MWWorld mMovementQueue.push_back(std::make_pair(ptr, movement)); } + void PhysicsSystem::clearQueuedMovement() + { + mMovementQueue.clear(); + mCollisions.clear(); + mStandingCollisions.clear(); + } + const PtrVelocityList& PhysicsSystem::applyQueuedMovement(float dt) { // Collision events are only tracked for a single frame, so reset first diff --git a/apps/openmw/mwworld/physicssystem.hpp b/apps/openmw/mwworld/physicssystem.hpp index f0522426d3..e66c179b02 100644 --- a/apps/openmw/mwworld/physicssystem.hpp +++ b/apps/openmw/mwworld/physicssystem.hpp @@ -85,8 +85,12 @@ namespace MWWorld /// be overwritten. Valid until the next call to applyQueuedMovement. void queueObjectMovement(const Ptr &ptr, const Ogre::Vector3 &velocity); + /// Apply all queued movements, then clear the list. const PtrVelocityList& applyQueuedMovement(float dt); + /// Clear the queued movements list without applying. + void clearQueuedMovement(); + /// Return true if \a actor has been standing on \a object in this frame /// This will trigger whenever the object is directly below the actor. /// It doesn't matter if the actor is stationary or moving. diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index a84e4781d6..4deed671ee 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -840,6 +840,8 @@ namespace MWWorld void World::changeToInteriorCell (const std::string& cellName, const ESM::Position& position) { + mPhysics->clearQueuedMovement(); + if (mCurrentWorldSpace != cellName) { // changed worldspace @@ -855,6 +857,8 @@ namespace MWWorld void World::changeToExteriorCell (const ESM::Position& position) { + mPhysics->clearQueuedMovement(); + if (mCurrentWorldSpace != "sys::default") // FIXME { // changed worldspace