diff options
Diffstat (limited to 'source/gameengine/Ketsji/KX_TouchEventManager.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_TouchEventManager.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp index 4c999b0ed69..8e546b896bc 100644 --- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp +++ b/source/gameengine/Ketsji/KX_TouchEventManager.cpp @@ -54,6 +54,7 @@ KX_TouchEventManager::KX_TouchEventManager(class SCA_LogicManager* logicmgr, m_physEnv->addTouchCallback(PHY_OBJECT_RESPONSE, KX_TouchEventManager::newCollisionResponse, this); m_physEnv->addTouchCallback(PHY_SENSOR_RESPONSE, KX_TouchEventManager::newCollisionResponse, this); + m_physEnv->addTouchCallback(PHY_BROADPH_RESPONSE, KX_TouchEventManager::newBroadphaseResponse, this); } @@ -79,6 +80,26 @@ bool KX_TouchEventManager::newCollisionResponse(void *client_data, return false; } +bool KX_TouchEventManager::newBroadphaseResponse(void *client_data, + void *object1, + void *object2, + const PHY_CollData *coll_data) +{ + PHY_IPhysicsController* ctrl = static_cast<PHY_IPhysicsController*>(object1); + KX_ClientObjectInfo* info = (ctrl) ? static_cast<KX_ClientObjectInfo*>(ctrl->getNewClientInfo()) : NULL; + // This call back should only be called for controllers of Near and Radar sensor + if (info && + info->m_sensors.size() == 1 && + (info->m_type == KX_ClientObjectInfo::NEAR || + info->m_type == KX_ClientObjectInfo::RADAR)) + { + // only one sensor for this type of object + KX_TouchSensor* touchsensor = static_cast<KX_TouchSensor*>(*info->m_sensors.begin()); + return touchsensor->BroadPhaseFilterCollision(object1,object2); + } + return true; +} + void KX_TouchEventManager::RegisterSensor(SCA_ISensor* sensor) { KX_TouchSensor* touchsensor = static_cast<KX_TouchSensor*>(sensor); |