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

Merge remote-tracking branch 'vheuken/master'

This commit is contained in:
Marc Zinnschlag 2013-06-29 12:27:01 +02:00
commit 56637a39a3
6 changed files with 35 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; virtual void getItemsOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out) = 0;
///< get all items in active cells owned by this Npc ///< 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 void setupExternalRendering (MWRender::ExternalRendering& rendering) = 0;
virtual int canRest() = 0; virtual int canRest() = 0;

View file

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

View file

@ -1751,4 +1751,18 @@ namespace MWWorld
out.push_back(searchPtrViaHandle(*it)); 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->enableCollisionBody();
}
else
{
physicActor->disableCollisionBody();
}
}
} }

View file

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

View file

@ -146,6 +146,16 @@ namespace Physic
return collisionMode && onGround; return collisionMode && onGround;
} }
void PhysicActor::disableCollisionBody()
{
mEngine->dynamicsWorld->removeRigidBody(mBody);
}
void PhysicActor::enableCollisionBody()
{
mEngine->dynamicsWorld->addRigidBody(mBody);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -129,6 +129,9 @@ namespace Physic
bool getOnGround() const; bool getOnGround() const;
void disableCollisionBody();
void enableCollisionBody();
//HACK: in Visual Studio 2010 and presumably above, this structures alignment //HACK: in Visual Studio 2010 and presumably above, this structures alignment
// must be 16, but the built in operator new & delete don't properly // must be 16, but the built in operator new & delete don't properly
// perform this alignment. // perform this alignment.