From 48769691531fd40822cb9166183a047d6f13762c Mon Sep 17 00:00:00 2001 From: fredzio Date: Fri, 30 Oct 2020 23:53:07 +0100 Subject: [PATCH] Use the PhysicsSystem::movementQueue instead of a serie of setPosition(getPosition() + diff) to move actor in scripts. With background physics, this is very slightly off with the collision object position. When the script run long enough (a few dozen frames for instance), the accumulated error becomes too big. It make actors fall through lifts floors. --- apps/openmw/mwscript/transformationextensions.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/openmw/mwscript/transformationextensions.cpp b/apps/openmw/mwscript/transformationextensions.cpp index ce45729b3..41df1870c 100644 --- a/apps/openmw/mwscript/transformationextensions.cpp +++ b/apps/openmw/mwscript/transformationextensions.cpp @@ -32,11 +32,7 @@ namespace MWScript std::vector actors; MWBase::Environment::get().getWorld()->getActorsStandingOn (ptr, actors); for (auto& actor : actors) - { - osg::Vec3f actorPos(actor.getRefData().getPosition().asVec3()); - actorPos += diff; - MWBase::Environment::get().getWorld()->moveObject(actor, actorPos.x(), actorPos.y(), actorPos.z()); - } + MWBase::Environment::get().getWorld()->queueMovement(actor, diff); } template