From 4a6dbe6f8971b49bf2a426a7d0d57dcfd15d9e7f Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 25 Jun 2014 18:15:56 +0200 Subject: [PATCH] Use the actor's collision group/mask for traces Fixes dead bodies being lifted up when standing below them. --- libs/openengine/bullet/physic.cpp | 2 +- libs/openengine/bullet/trace.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index 31530ebad..6bc544af4 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -180,7 +180,7 @@ namespace Physic { mEngine->mDynamicsWorld->removeRigidBody(mBody); mEngine->mDynamicsWorld->addRigidBody(mBody, CollisionType_Actor, - CollisionType_Raycasting); + CollisionType_World|CollisionType_HeightMap); } void PhysicActor::enableCollisionBody() diff --git a/libs/openengine/bullet/trace.cpp b/libs/openengine/bullet/trace.cpp index 46db4c6b8..ad140f1f7 100644 --- a/libs/openengine/bullet/trace.cpp +++ b/libs/openengine/bullet/trace.cpp @@ -65,9 +65,9 @@ void ActorTracer::doTrace(btCollisionObject *actor, const Ogre::Vector3 &start, to.setOrigin(btend); ClosestNotMeConvexResultCallback newTraceCallback(actor, btstart-btend, btScalar(0.0)); - newTraceCallback.m_collisionFilterGroup = CollisionType_Actor; - newTraceCallback.m_collisionFilterMask = CollisionType_World | CollisionType_HeightMap | - CollisionType_Actor; + // Inherit the actor's collision group and mask + newTraceCallback.m_collisionFilterGroup = actor->getBroadphaseHandle()->m_collisionFilterGroup; + newTraceCallback.m_collisionFilterMask = actor->getBroadphaseHandle()->m_collisionFilterMask; btCollisionShape *shape = actor->getCollisionShape(); assert(shape->isConvex()); @@ -100,9 +100,9 @@ void ActorTracer::findGround(const OEngine::Physic::PhysicActor* actor, const Og btTransform to(trans.getBasis(), btend); ClosestNotMeConvexResultCallback newTraceCallback(actor->getCollisionBody(), btstart-btend, btScalar(0.0)); - newTraceCallback.m_collisionFilterGroup = CollisionType_Actor; - newTraceCallback.m_collisionFilterMask = CollisionType_World | CollisionType_HeightMap | - CollisionType_Actor; + // Inherit the actor's collision group and mask + newTraceCallback.m_collisionFilterGroup = actor->getCollisionBody()->getBroadphaseHandle()->m_collisionFilterGroup; + newTraceCallback.m_collisionFilterMask = actor->getCollisionBody()->getBroadphaseHandle()->m_collisionFilterMask; btVector3 halfExtents(actor->getHalfExtents().x, actor->getHalfExtents().y, actor->getHalfExtents().z);