diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-09-05 03:07:43 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-09-05 03:07:43 +0400 |
commit | 2d50ead6b8ae689b34c8e1a6bd9f57f414f6cef8 (patch) | |
tree | 6bcaed50052e27b76a2a8e374baf63b5dbd78886 /source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | |
parent | d682dc5bd51ad2a2673bd0e93233a5ab6abbed55 (diff) |
Partial repair of raycast system with Bullet 2.71. Still to be done: face and normal information
Diffstat (limited to 'source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp')
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index f9242e6876f..228709999a5 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -721,17 +721,20 @@ struct FilterClosestRayResultCallback : public btCollisionWorld::ClosestRayResul { } - virtual bool NeedRayCast(btCollisionObject* object) + virtual bool needsCollision(btBroadphaseProxy* proxy0) const { + if (!(proxy0->m_collisionFilterGroup & m_collisionFilterMask)) + return false; + if (!(m_collisionFilterGroup & proxy0->m_collisionFilterMask)) + return false; + btCollisionObject* object = (btCollisionObject*)proxy0->m_clientObject; CcdPhysicsController* phyCtrl = static_cast<CcdPhysicsController*>(object->getUserPointer()); - if (phyCtrl != m_phyRayFilter.m_ignoreController) - { - return m_phyRayFilter.needBroadphaseRayCast(phyCtrl); - } - return false; + if (phyCtrl == m_phyRayFilter.m_ignoreController) + return false; + return m_phyRayFilter.needBroadphaseRayCast(phyCtrl); } - virtual float AddSingleResult( btCollisionWorld::LocalRayResult& rayResult) + virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace) { CcdPhysicsController* curHit = static_cast<CcdPhysicsController*>(rayResult.m_collisionObject->getUserPointer()); // save shape information as ClosestRayResultCallback::AddSingleResult() does not do it @@ -744,8 +747,7 @@ struct FilterClosestRayResultCallback : public btCollisionWorld::ClosestRayResul m_hitTriangleShape = NULL; m_hitTriangleIndex = 0; } - bool normalInWorldspace = true; - return ClosestRayResultCallback::addSingleResult(rayResult,normalInWorldspace); + return ClosestRayResultCallback::addSingleResult(rayResult,normalInWorldSpace); } }; |