1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 05:15:35 +00:00

Bug #869: Some fixes to the previous fix

This commit is contained in:
scrawl 2014-05-14 07:13:12 +02:00
parent 7697ab37e0
commit 67e942e733
4 changed files with 12 additions and 3 deletions

View file

@ -164,7 +164,11 @@ namespace MWClass
{
const std::string model = getModel(ptr);
if(!model.empty())
{
physics.addActor(ptr);
if (getCreatureStats(ptr).isDead())
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
}
MWBase::Environment::get().getMechanicsManager()->add(ptr);
}

View file

@ -388,6 +388,8 @@ namespace MWClass
{
physics.addActor(ptr);
MWBase::Environment::get().getMechanicsManager()->add(ptr);
if (getCreatureStats(ptr).isDead())
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
}
bool Npc::isPersistent(const MWWorld::Ptr &actor) const

View file

@ -18,6 +18,7 @@ namespace Physic
PhysicActor::PhysicActor(const std::string &name, const std::string &mesh, PhysicEngine *engine, const Ogre::Vector3 &position, const Ogre::Quaternion &rotation, float scale)
: mName(name), mEngine(engine), mMesh(mesh), mBoxScaledTranslation(0,0,0), mBoxRotationInverse(0,0,0,0)
, mBody(0), mRaycastingBody(0), mOnGround(false), mCollisionMode(true), mBoxRotation(0,0,0,0)
, mCollisionBody(true)
, mForce(0.0f)
{
mBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, position, rotation, &mBoxScaledTranslation, &mBoxRotation);
@ -49,8 +50,9 @@ namespace Physic
void PhysicActor::enableCollisionBody(bool collision)
{
assert(mBody);
if(collision && !mCollisionMode) enableCollisionBody();
if(!collision && mCollisionMode) disableCollisionBody();
if(collision && !mCollisionBody) enableCollisionBody();
if(!collision && mCollisionBody) disableCollisionBody();
mCollisionBody = collision;
}
void PhysicActor::setPosition(const Ogre::Vector3 &pos)
@ -108,7 +110,7 @@ namespace Physic
//Create the newly scaled rigid body
mBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, pos, rot);
mRaycastingBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, pos, rot, 0, 0, true);
mEngine->addRigidBody(mBody, false, mRaycastingBody,true); //Add rigid body to dynamics world, but do not add to object map
mEngine->addRigidBody(mCollisionBody ? mBody : 0, false, mRaycastingBody,true); //Add rigid body to dynamics world, but do not add to object map
}
Ogre::Vector3 PhysicActor::getHalfExtents() const

View file

@ -175,6 +175,7 @@ namespace Physic
Ogre::Vector3 mForce;
bool mOnGround;
bool mCollisionMode;
bool mCollisionBody;
std::string mMesh;
std::string mName;