mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 06:15:32 +00:00
Fixes #869: Added methods to control external and internal collision modes separately
When an actor dies, we should only disable external collisions, i.e. prevent other actors from colliding with the dead body. The dead actor, however, should still have gravity and collision applied. Also moved disableCollision to when the death animation finishes, not as soon as the actor's health is 0.
This commit is contained in:
parent
f11079f1e4
commit
386604bc9d
5 changed files with 20 additions and 10 deletions
|
@ -920,9 +920,6 @@ namespace MWMechanics
|
|||
spells.purge(iter->first.getRefData().getHandle());
|
||||
}
|
||||
|
||||
// FIXME: see http://bugs.openmw.org/issues/869
|
||||
MWBase::Environment::get().getWorld()->enableActorCollision(iter->first, false);
|
||||
|
||||
if (iter->second->kill())
|
||||
{
|
||||
++mDeathCount[cls.getId(iter->first)];
|
||||
|
@ -939,6 +936,8 @@ namespace MWMechanics
|
|||
stats.setMagicEffects(MWMechanics::MagicEffects());
|
||||
calculateCreatureStatModifiers(iter->first, 0);
|
||||
|
||||
MWBase::Environment::get().getWorld()->enableActorCollision(iter->first, false);
|
||||
|
||||
if (cls.isEssential(iter->first))
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sKilledEssential}");
|
||||
}
|
||||
|
|
|
@ -626,12 +626,12 @@ namespace MWWorld
|
|||
bool cmode = act->getCollisionMode();
|
||||
if(cmode)
|
||||
{
|
||||
act->enableCollisions(false);
|
||||
act->enableCollisionMode(false);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
act->enableCollisions(true);
|
||||
act->enableCollisionMode(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1957,7 +1957,7 @@ namespace MWWorld
|
|||
{
|
||||
OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle());
|
||||
|
||||
physicActor->enableCollisions(enable);
|
||||
physicActor->enableCollisionBody(enable);
|
||||
}
|
||||
|
||||
bool World::findInteriorPosition(const std::string &name, ESM::Position &pos)
|
||||
|
|
|
@ -41,15 +41,18 @@ namespace Physic
|
|||
}
|
||||
}
|
||||
|
||||
void PhysicActor::enableCollisions(bool collision)
|
||||
void PhysicActor::enableCollisionMode(bool collision)
|
||||
{
|
||||
mCollisionMode = collision;
|
||||
}
|
||||
|
||||
void PhysicActor::enableCollisionBody(bool collision)
|
||||
{
|
||||
assert(mBody);
|
||||
if(collision && !mCollisionMode) enableCollisionBody();
|
||||
if(!collision && mCollisionMode) disableCollisionBody();
|
||||
mCollisionMode = collision;
|
||||
}
|
||||
|
||||
|
||||
void PhysicActor::setPosition(const Ogre::Vector3 &pos)
|
||||
{
|
||||
assert(mBody);
|
||||
|
|
|
@ -99,7 +99,15 @@ namespace Physic
|
|||
*/
|
||||
void setRotation(const Ogre::Quaternion &quat);
|
||||
|
||||
void enableCollisions(bool collision);
|
||||
/**
|
||||
* Sets the collisionMode for this actor. If disabled, the actor can fly and clip geometry.
|
||||
*/
|
||||
void enableCollisionMode(bool collision);
|
||||
|
||||
/**
|
||||
* Enables or disables the *external* collision body. If disabled, other actors will not collide with this actor.
|
||||
*/
|
||||
void enableCollisionBody(bool collision);
|
||||
|
||||
bool getCollisionMode() const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue