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

remove actor's collisionbox on death

This commit is contained in:
Vincent Heuken 2013-06-27 19:42:27 -07:00
parent b095c24854
commit f43b48015e
3 changed files with 16 additions and 3 deletions

View file

@ -1756,13 +1756,13 @@ namespace MWWorld
{ {
OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle()); OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle());
if (!enable) if (enable)
{ {
physicActor->setScale(0.15); physicActor->enableCollisionBody();
} }
else else
{ {
physicActor->setScale(1); physicActor->disableCollisionBody();
} }
} }
} }

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.