1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-22 20:11:33 +00:00

Make sure physics simulation does not reset flags for nonprocessed actors

Actor::getOnGround and Actor::getOnSlope is used to initialize ActorFrameData.
After a physics simulation the result is copied back. But when actor is outside
processing range, Actor::mInternalCollisionMode is false and physics simulation
does not recalculate OnGround and OnSlope flags. So the flags are always set to
false that makes actor play landing animation when they exit and then enter
actors processing range.
This commit is contained in:
elsid 2022-05-24 23:24:52 +02:00
parent ec6ba3deeb
commit 617cd4ceb6
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
2 changed files with 4 additions and 10 deletions

View file

@ -116,17 +116,11 @@ namespace MWPhysics
void setOnGround(bool grounded); void setOnGround(bool grounded);
bool getOnGround() const bool getOnGround() const { return mOnGround; }
{
return mInternalCollisionMode && mOnGround;
}
void setOnSlope(bool slope); void setOnSlope(bool slope);
bool getOnSlope() const bool getOnSlope() const { return mOnSlope; }
{
return mInternalCollisionMode && mOnSlope;
}
/// Sets whether this actor should be able to collide with the water surface /// Sets whether this actor should be able to collide with the water surface
void setCanWaterWalk(bool waterWalk); void setCanWaterWalk(bool waterWalk);

View file

@ -176,7 +176,7 @@ namespace MWPhysics
bool PhysicsSystem::isOnSolidGround (const MWWorld::Ptr& actor) const bool PhysicsSystem::isOnSolidGround (const MWWorld::Ptr& actor) const
{ {
const Actor* physactor = getActor(actor); const Actor* physactor = getActor(actor);
if (!physactor || !physactor->getOnGround()) if (!physactor || !physactor->getOnGround() || !physactor->getCollisionMode())
return false; return false;
const auto obj = physactor->getStandingOnPtr(); const auto obj = physactor->getStandingOnPtr();
@ -374,7 +374,7 @@ namespace MWPhysics
bool PhysicsSystem::isOnGround(const MWWorld::Ptr &actor) bool PhysicsSystem::isOnGround(const MWWorld::Ptr &actor)
{ {
Actor* physactor = getActor(actor); Actor* physactor = getActor(actor);
return physactor && physactor->getOnGround(); return physactor && physactor->getOnGround() && physactor->getCollisionMode();
} }
bool PhysicsSystem::canMoveToWaterSurface(const MWWorld::ConstPtr &actor, const float waterlevel) bool PhysicsSystem::canMoveToWaterSurface(const MWWorld::ConstPtr &actor, const float waterlevel)