diff --git a/apps/openmw/mwphysics/actor.hpp b/apps/openmw/mwphysics/actor.hpp index 01d8037f6b..cdf49eeb54 100644 --- a/apps/openmw/mwphysics/actor.hpp +++ b/apps/openmw/mwphysics/actor.hpp @@ -158,6 +158,9 @@ namespace MWPhysics bool canMoveToWaterSurface(float waterlevel, const btCollisionWorld* world) const; + /// Returns the mesh translation, scaled and rotated as necessary + osg::Vec3f getScaledMeshTranslation() const; + private: MWWorld::Ptr mStandingOnPtr; /// Removes then re-adds the collision object to the dynamics world @@ -165,9 +168,6 @@ namespace MWPhysics void addCollisionMask(int collisionMask); int getCollisionMask() const; - /// Returns the mesh translation, scaled and rotated as necessary - osg::Vec3f getScaledMeshTranslation() const; - bool mCanWaterWalk; bool mWalkingOnWater; diff --git a/apps/openmw/mwphysics/movementsolver.cpp b/apps/openmw/mwphysics/movementsolver.cpp index fd8a7f2b05..8987c8d8a3 100644 --- a/apps/openmw/mwphysics/movementsolver.cpp +++ b/apps/openmw/mwphysics/movementsolver.cpp @@ -134,8 +134,6 @@ namespace MWPhysics // Adjust for collision mesh offset relative to actor's "location" // (doTrace doesn't take local/interior collision shape translation into account, so we have to do it on our own) - // for compatibility with vanilla assets, we have to derive this from the vertical half extent instead of from internal hull translation - // if not for this hack, the "correct" collision hull position would be physicActor->getScaledMeshTranslation() actor.mPosition.z() += actor.mHalfExtentsZ; // vanilla-accurate float swimlevel = actor.mSwimLevel + actor.mHalfExtentsZ; @@ -465,8 +463,6 @@ namespace MWPhysics } } - // use vanilla-accurate collision hull position hack (do same hitbox offset hack as movement solver) - // if vanilla compatibility didn't matter, the "correct" collision hull position would be physicActor->getScaledMeshTranslation() const auto verticalHalfExtent = osg::Vec3f(0.0, 0.0, actor.mHalfExtentsZ); // use a 3d approximation of the movement vector to better judge player intent diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 195af630f5..ef7fffa034 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -934,7 +934,8 @@ namespace MWPhysics , mRotation() , mMovement(actor.velocity()) , mWaterlevel(waterlevel) - , mHalfExtentsZ(actor.getHalfExtents().z()) + // for compatibility with vanilla assets, mesh offset is the actor halfextent for dead actors + , mHalfExtentsZ(actor.getPtr().getClass().getCreatureStats(actor.getPtr()).isDead() ? actor.getHalfExtents().z() : actor.getScaledMeshTranslation().z()) , mOldHeight(0) , mStuckFrames(0) , mFlying(MWBase::Environment::get().getWorld()->isFlying(actor.getPtr()))