Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2009-05-29 20:55:22 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2009-05-29 20:55:22 +0400
commitd5b27fabcc4f8289b9315248a16a22f7045d9363 (patch)
treed3bec4b898ebbf417f11d2d00e9faf116969cc67
parentdd9c9efde7d8fbc2247b6c6b3d15c5c76aa787b9 (diff)
BGE: sensor object will now have Actor filter optional: new button 'Detect Actor' in physics settings indicate if you want the sensor to detect only Actor object or all objects. This way you don't need to set the scenery to Actor to detect ground for example.
-rw-r--r--source/blender/src/buttons_logic.c7
-rw-r--r--source/gameengine/Ketsji/KX_ClientObjectInfo.h5
-rw-r--r--source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_TouchEventManager.cpp1
-rw-r--r--source/gameengine/Ketsji/KX_TouchSensor.cpp4
5 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index a1fddfefb9c..9fb6ec4752b 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -3355,11 +3355,12 @@ static void buttons_bullet(uiBlock *block, Object *ob)
if (ob->gameflag & OB_COLLISION) {
if (ob->gameflag & OB_SENSOR) {
- uiBlockEndAlign(block);
+ uiDefButBitI(block, TOG, OB_ACTOR, 0, "Detect Actor",
+ 110, 205, 100, 19, &ob->gameflag, 0, 0, 0, 0,
+ "Sensor should detect only the objects with Actor option enabled. Unset to detect all objects");
uiDefBlockBut(block, advanced_bullet_menu, ob,
"Advanced",
270, 205, 80, 19, "Display collision advanced settings");
- uiBlockBeginAlign(block);
} else {
uiDefButBitI(block, TOG, OB_ACTOR, 0, "Actor",
110, 205, 50, 19, &ob->gameflag, 0, 0, 0, 0,
@@ -3379,7 +3380,7 @@ static void buttons_bullet(uiBlock *block, Object *ob)
//uiBlockSetCol(block, TH_BUT_SETTING2);
}
-
+ uiBlockBeginAlign(block);
if(ob->gameflag & OB_DYNAMIC) {
if (!(ob->gameflag & OB_SOFT_BODY))
diff --git a/source/gameengine/Ketsji/KX_ClientObjectInfo.h b/source/gameengine/Ketsji/KX_ClientObjectInfo.h
index 74d463fbf20..077ac96f0ac 100644
--- a/source/gameengine/Ketsji/KX_ClientObjectInfo.h
+++ b/source/gameengine/Ketsji/KX_ClientObjectInfo.h
@@ -51,7 +51,8 @@ struct KX_ClientObjectInfo
ACTOR,
RESERVED1,
SENSOR,
- OBSENSOR
+ OBSENSOR,
+ OBACTORSENSOR
} m_type;
KX_GameObject* m_gameobject;
void* m_auxilary_info;
@@ -84,7 +85,7 @@ public:
}
bool isActor() { return m_type <= ACTOR; }
- bool isSensor() { return m_type >= SENSOR && m_type <= OBSENSOR; }
+ bool isSensor() { return m_type >= SENSOR && m_type <= OBACTORSENSOR; }
};
#endif //__KX_CLIENTOBJECT_INFO_H
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
index cdba59dd9ca..297b15a2b78 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
@@ -1186,7 +1186,7 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
bool isActor = objprop->m_isactor;
gameobj->getClientInfo()->m_type =
- (isbulletsensor) ? KX_ClientObjectInfo::OBSENSOR :
+ (isbulletsensor) ? ((isActor) ? KX_ClientObjectInfo::OBACTORSENSOR : KX_ClientObjectInfo::OBSENSOR) :
(isActor) ? KX_ClientObjectInfo::ACTOR : KX_ClientObjectInfo::STATIC;
// store materialname in auxinfo, needed for touchsensors
if (meshobj)
diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
index 9603410c3ac..712a512995e 100644
--- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp
+++ b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
@@ -99,6 +99,7 @@ bool KX_TouchEventManager::newBroadphaseResponse(void *client_data,
}
break;
case KX_ClientObjectInfo::OBSENSOR:
+ case KX_ClientObjectInfo::OBACTORSENSOR:
// this object may have multiple collision sensors,
// check is any of them is interested in this object
for(std::list<SCA_ISensor*>::iterator it = info->m_sensors.begin();
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp
index 509fc60e9f5..c06acd4a873 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.cpp
+++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp
@@ -204,6 +204,7 @@ bool KX_TouchSensor::BroadPhaseSensorFilterCollision(void*obj1,void*obj2)
KX_GameObject* myobj = (KX_GameObject*)GetParent();
KX_GameObject* myparent = myobj->GetParent();
KX_ClientObjectInfo* client_info = static_cast<KX_ClientObjectInfo*>(((PHY_IPhysicsController*)obj2)->getNewClientInfo());
+ KX_ClientObjectInfo* my_client_info = static_cast<KX_ClientObjectInfo*>(m_physCtrl->getNewClientInfo());
KX_GameObject* otherobj = ( client_info ? client_info->m_gameobject : NULL);
// first, decrement refcount as GetParent() increases it
@@ -214,7 +215,8 @@ bool KX_TouchSensor::BroadPhaseSensorFilterCollision(void*obj1,void*obj2)
// good candidate because they are transient. That must be handled at another level
if (!otherobj ||
otherobj == myparent || // don't interact with our parent
- client_info->m_type != KX_ClientObjectInfo::ACTOR) // only with actor objects
+ (my_client_info->m_type == KX_ClientObjectInfo::OBACTORSENSOR &&
+ client_info->m_type != KX_ClientObjectInfo::ACTOR)) // only with actor objects
return false;
bool found = m_touchedpropname.IsEmpty();