1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 10:23:56 +00:00

resize actor collision boxes on death

This commit is contained in:
Vincent Heuken 2013-06-27 14:11:20 -07:00
parent e88040662e
commit b095c24854
4 changed files with 22 additions and 0 deletions

View file

@ -345,6 +345,8 @@ namespace MWBase
virtual void getItemsOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out) = 0;
///< get all items in active cells owned by this Npc
virtual void enableActorCollision(const MWWorld::Ptr& actor, bool enable) = 0;
virtual void setupExternalRendering (MWRender::ExternalRendering& rendering) = 0;
virtual int canRest() = 0;

View file

@ -462,6 +462,10 @@ void CharacterController::update(float duration, Movement &movement)
mAnimation->disable("torch");
}
}
else if (cls.getCreatureStats(mPtr).isDead())
{
MWBase::Environment::get().getWorld()->enableActorCollision(mPtr, false);
}
if(mAnimation && !mSkipAnim)
{

View file

@ -1751,4 +1751,18 @@ namespace MWWorld
out.push_back(searchPtrViaHandle(*it));
}
}
void World::enableActorCollision(const MWWorld::Ptr& actor, bool enable)
{
OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle());
if (!enable)
{
physicActor->setScale(0.15);
}
else
{
physicActor->setScale(1);
}
}
}

View file

@ -394,6 +394,8 @@ namespace MWWorld
virtual void getItemsOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out);
///< get all items in active cells owned by this Npc
virtual void enableActorCollision(const MWWorld::Ptr& actor, bool enable);
virtual void setupExternalRendering (MWRender::ExternalRendering& rendering);
virtual int canRest();