Other actors no longer collide with an actor that has collision disabled

pull/51/head
scrawl 12 years ago
parent 472a381263
commit 04b90b7d14

@ -118,7 +118,8 @@ namespace MWWorld
newPosition = trace.endpos;
physicActor->setOnGround(hit && getSlope(trace.planenormal) <= sMaxSlope);
physicActor->enableCollisions(wasCollisionMode);
if (wasCollisionMode)
physicActor->enableCollisions(true);
if (hit)
return newPosition+Ogre::Vector3(0,0,4);
@ -148,6 +149,7 @@ namespace MWWorld
float remainingTime = time;
bool isInterior = !ptr.getCell()->isExterior();
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();// + Vector3(1,1,1);
bool wasCollisionMode = physicActor->getCollisionMode();
physicActor->enableCollisions(false);
Ogre::Quaternion orient = Ogre::Quaternion(Ogre::Radian(ptr.getRefData().getPosition().rot[2]), Ogre::Vector3::UNIT_Z);
Ogre::Vector3 velocity;
@ -228,7 +230,8 @@ namespace MWWorld
}
physicActor->setOnGround(onground);
physicActor->setVerticalForce(!onground ? clippedVelocity.z - time*627.2f : 0.0f);
physicActor->enableCollisions(true);
if (wasCollisionMode)
physicActor->enableCollisions(true);
return newPosition;
}
};

@ -1764,14 +1764,7 @@ namespace MWWorld
{
OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle());
if (enable)
{
physicActor->enableCollisionBody();
}
else
{
physicActor->disableCollisionBody();
}
physicActor->enableCollisions(enable);
}
bool World::findInteriorPosition(const std::string &name, ESM::Position &pos)

@ -45,8 +45,8 @@ namespace Physic
void PhysicActor::enableCollisions(bool collision)
{
assert(mBody);
if(collision && !collisionMode) mBody->translate(btVector3(0,0,-1000));
if(!collision && collisionMode) mBody->translate(btVector3(0,0,1000));
if(collision && !collisionMode) enableCollisionBody();
if(!collision && collisionMode) disableCollisionBody();
collisionMode = collision;
}

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

Loading…
Cancel
Save