Make doors move through dead actors (Fixes #1608)

deque
scrawl 11 years ago
parent 98bc4618cb
commit f8040da694

@ -612,9 +612,9 @@ namespace MWWorld
} }
} }
std::vector<std::string> PhysicsSystem::getCollisions(const Ptr &ptr) std::vector<std::string> PhysicsSystem::getCollisions(const Ptr &ptr, int collisionGroup, int collisionMask)
{ {
return mEngine->getCollisions(ptr.getRefData().getBaseNode()->getName()); return mEngine->getCollisions(ptr.getRefData().getBaseNode()->getName(), collisionGroup, collisionMask);
} }
Ogre::Vector3 PhysicsSystem::traceDown(const MWWorld::Ptr &ptr, float maxHeight) Ogre::Vector3 PhysicsSystem::traceDown(const MWWorld::Ptr &ptr, float maxHeight)

@ -55,7 +55,7 @@ namespace MWWorld
void stepSimulation(float dt); void stepSimulation(float dt);
std::vector<std::string> getCollisions(const MWWorld::Ptr &ptr); ///< get handles this object collides with std::vector<std::string> getCollisions(const MWWorld::Ptr &ptr, int collisionGroup, int collisionMask); ///< get handles this object collides with
Ogre::Vector3 traceDown(const MWWorld::Ptr &ptr, float maxHeight); Ogre::Vector3 traceDown(const MWWorld::Ptr &ptr, float maxHeight);
std::pair<float, std::string> getFacedHandle(float queryDistance); std::pair<float, std::string> getFacedHandle(float queryDistance);

@ -1284,7 +1284,8 @@ namespace MWWorld
bool reached = (targetRot == 90.f && it->second) || targetRot == 0.f; bool reached = (targetRot == 90.f && it->second) || targetRot == 0.f;
/// \todo should use convexSweepTest here /// \todo should use convexSweepTest here
std::vector<std::string> collisions = mPhysics->getCollisions(it->first); std::vector<std::string> collisions = mPhysics->getCollisions(it->first, OEngine::Physic::CollisionType_Actor
, OEngine::Physic::CollisionType_Actor);
for (std::vector<std::string>::iterator cit = collisions.begin(); cit != collisions.end(); ++cit) for (std::vector<std::string>::iterator cit = collisions.begin(); cit != collisions.end(); ++cit)
{ {
MWWorld::Ptr ptr = getPtrViaHandle(*cit); MWWorld::Ptr ptr = getPtrViaHandle(*cit);
@ -1300,7 +1301,6 @@ namespace MWWorld
// we need to undo the rotation // we need to undo the rotation
localRotateObject(it->first, 0, 0, oldRot); localRotateObject(it->first, 0, 0, oldRot);
reached = false; reached = false;
//break; //Removed in case multiple actors are touching
} }
} }

@ -661,12 +661,14 @@ namespace Physic
}; };
std::vector<std::string> PhysicEngine::getCollisions(const std::string& name) std::vector<std::string> PhysicEngine::getCollisions(const std::string& name, int collisionGroup, int collisionMask)
{ {
RigidBody* body = getRigidBody(name); RigidBody* body = getRigidBody(name);
if (!body) // fall back to raycasting body if there is no collision body if (!body) // fall back to raycasting body if there is no collision body
body = getRigidBody(name, true); body = getRigidBody(name, true);
ContactTestResultCallback callback; ContactTestResultCallback callback;
callback.m_collisionFilterGroup = collisionGroup;
callback.m_collisionFilterMask = collisionMask;
mDynamicsWorld->contactTest(body, callback); mDynamicsWorld->contactTest(body, callback);
return callback.mResult; return callback.mResult;
} }

@ -311,7 +311,7 @@ namespace Physic
std::pair<bool, float> sphereCast (float radius, btVector3& from, btVector3& to); std::pair<bool, float> sphereCast (float radius, btVector3& from, btVector3& to);
///< @return (hit, relative distance) ///< @return (hit, relative distance)
std::vector<std::string> getCollisions(const std::string& name); std::vector<std::string> getCollisions(const std::string& name, int collisionGroup, int collisionMask);
// Get the nearest object that's inside the given object, filtering out objects of the // Get the nearest object that's inside the given object, filtering out objects of the
// provided name // provided name

Loading…
Cancel
Save