Bug #869: Some fixes to the previous fix

deque
scrawl 11 years ago
parent 7697ab37e0
commit 67e942e733

@ -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);
}

@ -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

@ -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

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

Loading…
Cancel
Save