Merge pull request #2112 from Capostrophic/collision

[0.45.0 regression] Don't re-enable collision body for dead actors
pull/541/head
Bret Curtis 6 years ago committed by GitHub
commit a573efd30a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -312,7 +312,7 @@ namespace MWBase
virtual bool castRay (float x1, float y1, float z1, float x2, float y2, float z2) = 0;
virtual void setActorCollisionMode(const MWWorld::Ptr& ptr, bool enabled) = 0;
virtual void setActorCollisionMode(const MWWorld::Ptr& ptr, bool internal, bool external) = 0;
virtual bool isActorCollisionEnabled(const MWWorld::Ptr& ptr) = 0;
virtual bool toggleCollisionMode() = 0;

@ -1457,7 +1457,7 @@ namespace MWMechanics
if (!inRange)
{
iter->first.getRefData().getBaseNode()->setNodeMask(0);
world->setActorCollisionMode(iter->first, false);
world->setActorCollisionMode(iter->first, false, false);
continue;
}
else if (!isPlayer)
@ -1474,7 +1474,7 @@ namespace MWMechanics
continue;
}
world->setActorCollisionMode(iter->first, true);
world->setActorCollisionMode(iter->first, true, !iter->first.getClass().getCreatureStats(iter->first).isDeathAnimationFinished());
ctrl->update(duration);
// Fade away actors on large distance (>90% of actor's processing distance)

@ -1216,33 +1216,6 @@ namespace MWPhysics
return false;
}
void PhysicsSystem::setActorCollisionMode(const MWWorld::Ptr& ptr, bool enabled)
{
ActorMap::iterator found = mActors.find(ptr);
if (found != mActors.end())
{
bool cmode = found->second->getCollisionMode();
if (cmode == enabled)
return;
cmode = enabled;
found->second->enableCollisionMode(cmode);
found->second->enableCollisionBody(cmode);
}
}
bool PhysicsSystem::isActorCollisionEnabled(const MWWorld::Ptr& ptr)
{
ActorMap::iterator found = mActors.find(ptr);
if (found != mActors.end())
{
bool cmode = found->second->getCollisionMode();
return cmode;
}
return false;
}
void PhysicsSystem::queueObjectMovement(const MWWorld::Ptr &ptr, const osg::Vec3f &movement)
{
PtrVelocityList::iterator iter = mMovementQueue.begin();

@ -92,8 +92,6 @@ namespace MWPhysics
const HeightField* getHeightField(int x, int y) const;
bool toggleCollisionMode();
bool isActorCollisionEnabled(const MWWorld::Ptr& ptr);
void setActorCollisionMode(const MWWorld::Ptr& ptr, bool enabled);
void stepSimulation(float dt);
void debugDraw();

@ -1684,14 +1684,20 @@ namespace MWWorld
}
}
void World::setActorCollisionMode(const MWWorld::Ptr& ptr, bool enabled)
void World::setActorCollisionMode(const MWWorld::Ptr& ptr, bool internal, bool external)
{
mPhysics->setActorCollisionMode(ptr, enabled);
MWPhysics::Actor *physicActor = mPhysics->getActor(ptr);
if (physicActor && physicActor->getCollisionMode() != internal)
{
physicActor->enableCollisionMode(internal);
physicActor->enableCollisionBody(external);
}
}
bool World::isActorCollisionEnabled(const MWWorld::Ptr& ptr)
{
return mPhysics->isActorCollisionEnabled(ptr);
MWPhysics::Actor *physicActor = mPhysics->getActor(ptr);
return physicActor && physicActor->getCollisionMode();
}
bool World::toggleCollisionMode()

@ -421,7 +421,7 @@ namespace MWWorld
bool castRay (float x1, float y1, float z1, float x2, float y2, float z2) override;
void setActorCollisionMode(const Ptr& ptr, bool enabled) override;
void setActorCollisionMode(const Ptr& ptr, bool internal, bool external) override;
bool isActorCollisionEnabled(const Ptr& ptr) override;
bool toggleCollisionMode() override;

Loading…
Cancel
Save