forked from teamnwah/openmw-tes3coop
Other actors no longer collide with an actor that has collision disabled
This commit is contained in:
parent
472a381263
commit
04b90b7d14
4 changed files with 10 additions and 13 deletions
|
@ -118,7 +118,8 @@ namespace MWWorld
|
||||||
newPosition = trace.endpos;
|
newPosition = trace.endpos;
|
||||||
|
|
||||||
physicActor->setOnGround(hit && getSlope(trace.planenormal) <= sMaxSlope);
|
physicActor->setOnGround(hit && getSlope(trace.planenormal) <= sMaxSlope);
|
||||||
physicActor->enableCollisions(wasCollisionMode);
|
if (wasCollisionMode)
|
||||||
|
physicActor->enableCollisions(true);
|
||||||
|
|
||||||
if (hit)
|
if (hit)
|
||||||
return newPosition+Ogre::Vector3(0,0,4);
|
return newPosition+Ogre::Vector3(0,0,4);
|
||||||
|
@ -148,6 +149,7 @@ namespace MWWorld
|
||||||
float remainingTime = time;
|
float remainingTime = time;
|
||||||
bool isInterior = !ptr.getCell()->isExterior();
|
bool isInterior = !ptr.getCell()->isExterior();
|
||||||
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();// + Vector3(1,1,1);
|
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();// + Vector3(1,1,1);
|
||||||
|
bool wasCollisionMode = physicActor->getCollisionMode();
|
||||||
physicActor->enableCollisions(false);
|
physicActor->enableCollisions(false);
|
||||||
Ogre::Quaternion orient = Ogre::Quaternion(Ogre::Radian(ptr.getRefData().getPosition().rot[2]), Ogre::Vector3::UNIT_Z);
|
Ogre::Quaternion orient = Ogre::Quaternion(Ogre::Radian(ptr.getRefData().getPosition().rot[2]), Ogre::Vector3::UNIT_Z);
|
||||||
Ogre::Vector3 velocity;
|
Ogre::Vector3 velocity;
|
||||||
|
@ -228,7 +230,8 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
physicActor->setOnGround(onground);
|
physicActor->setOnGround(onground);
|
||||||
physicActor->setVerticalForce(!onground ? clippedVelocity.z - time*627.2f : 0.0f);
|
physicActor->setVerticalForce(!onground ? clippedVelocity.z - time*627.2f : 0.0f);
|
||||||
physicActor->enableCollisions(true);
|
if (wasCollisionMode)
|
||||||
|
physicActor->enableCollisions(true);
|
||||||
return newPosition;
|
return newPosition;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1764,14 +1764,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle());
|
OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle());
|
||||||
|
|
||||||
if (enable)
|
physicActor->enableCollisions(enable);
|
||||||
{
|
|
||||||
physicActor->enableCollisionBody();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
physicActor->disableCollisionBody();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool World::findInteriorPosition(const std::string &name, ESM::Position &pos)
|
bool World::findInteriorPosition(const std::string &name, ESM::Position &pos)
|
||||||
|
|
|
@ -45,8 +45,8 @@ namespace Physic
|
||||||
void PhysicActor::enableCollisions(bool collision)
|
void PhysicActor::enableCollisions(bool collision)
|
||||||
{
|
{
|
||||||
assert(mBody);
|
assert(mBody);
|
||||||
if(collision && !collisionMode) mBody->translate(btVector3(0,0,-1000));
|
if(collision && !collisionMode) enableCollisionBody();
|
||||||
if(!collision && collisionMode) mBody->translate(btVector3(0,0,1000));
|
if(!collision && collisionMode) disableCollisionBody();
|
||||||
collisionMode = collision;
|
collisionMode = collision;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,9 +129,10 @@ namespace Physic
|
||||||
|
|
||||||
bool getOnGround() const;
|
bool getOnGround() const;
|
||||||
|
|
||||||
|
private:
|
||||||
void disableCollisionBody();
|
void disableCollisionBody();
|
||||||
void enableCollisionBody();
|
void enableCollisionBody();
|
||||||
|
public:
|
||||||
//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.
|
||||||
|
|
Loading…
Reference in a new issue