Sensor objects were initialized as invisible, which conflicted with initializing the invisible setting from the outliner render object (which it seems nobody knew about).

Added an 'Invisible' button to make this more clear, it seems like a display option but its also related to logic because the actuators can toggle this after the game starts.

Without this its annoying to add UV's only to set the invisible flag.

Sensor objects were not clearing the softbody gameflag
This commit is contained in:
Campbell Barton 2009-05-18 10:27:09 +00:00
parent 07fc2aa526
commit cb96dc40e8
2 changed files with 13 additions and 8 deletions

@ -3068,7 +3068,7 @@ static void check_body_type(void *arg1_but, void *arg2_object)
switch (ob->body_type) {
case OB_BODY_TYPE_SENSOR:
ob->gameflag |= OB_SENSOR|OB_COLLISION|OB_GHOST;
ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION|OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE);
ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION|OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE);
break;
case OB_BODY_TYPE_OCCLUDER:
ob->gameflag |= OB_OCCLUDER;
@ -3316,13 +3316,20 @@ static void buttons_bullet(uiBlock *block, Object *ob)
10, 205, 100, 19, &ob->body_type, 0, 0, 0, 0, tip);
uiButSetFunc(but, check_body_type, but, ob);
uiBlockEndAlign(block);
uiDefButBitS(block, TOG, OB_RESTRICT_RENDER, B_NOP, "Invisible",
210, 205, 60, 19,
&ob->restrictflag, 0, 0, 0, 0,
"Initializes objects as invisible, this can be toggled by the visibility actuator (uses outliner render option)");
if (ob->gameflag & OB_COLLISION) {
if (ob->gameflag & OB_SENSOR) {
uiBlockEndAlign(block);
uiDefBlockBut(block, advanced_bullet_menu, ob,
"Advanced Settings",
210, 205, 140, 19, "Display collision advanced settings");
"Advanced",
270, 205, 80, 19, "Display collision advanced settings");
uiBlockBeginAlign(block);
} else {
uiDefButBitI(block, TOG, OB_ACTOR, 0, "Actor",
@ -3338,8 +3345,8 @@ static void buttons_bullet(uiBlock *block, Object *ob)
//uiBlockSetCol(block, TH_BUT_SETTING1);
uiDefBlockBut(block, advanced_bullet_menu, ob,
"Advanced Settings",
210, 205, 140, 19, "Display collision advanced settings");
"Advanced",
270, 205, 80, 19, "Display collision advanced settings");
//uiBlockSetCol(block, TH_BUT_SETTING2);
}

@ -1129,8 +1129,6 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
// bullet will not synchronize, we must do it explicitely
SG_Callbacks& callbacks = gameobj->GetSGNode()->GetCallBackFunctions();
callbacks.m_updatefunc = KX_GameObject::SynchronizeTransformFunc;
// make sensor object invisible by default
gameobj->SetVisible(false, false);
}
// don't add automatically sensor object, they are added when a collision sensor is registered
else if (objprop->m_in_active_layer)