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:
authorMitchell Stokes <mogurijin@gmail.com>2013-01-30 09:55:17 +0400
committerMitchell Stokes <mogurijin@gmail.com>2013-01-30 09:55:17 +0400
commit9191b783bb2bc1a2d4be2b2cd215735e68353a56 (patch)
tree8440c8b155a69580b358ded134bad49e27bb8eba /source/blender
parent26ee2a1f79c3513ca9eaeb6a3a8d855c37088468 (diff)
BGE: Some various changes to make moving the character physics type easier:
* Undoing the previous applyMovement() changes for characters. This was causing bugs for the Motion Actuator. * Creating a Character Motion type for the Motion Actuator with specific controls for characters. This includes moving, rotating and jumping. * Adding a KX_CharacterWrapper.walkDirection to set the character's direction and speed. Note, this also resolves the following bugs: [#33585] "Setting dLoc of motion actuator [0,0,0] via python won't stop object" reported by Manuel Bellersen (urfoex) [#33503] "Character physics type won´t accept more than one motion anymore" reported by Mr Larodos
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_logic/logic_window.c19
-rw-r--r--source/blender/makesdna/DNA_actuator_types.h7
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c17
3 files changed, 41 insertions, 2 deletions
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index f46151fd33a..fa7e888f8d7 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -1860,6 +1860,25 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
uiItemR(col, ptr, "integral_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "derivate_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
break;
+ case ACT_OBJECT_CHARACTER:
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
+ uiItemR(row, ptr, "offset_location", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(split, TRUE);
+ uiItemR(row, ptr, "use_local_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
+ uiItemR(row, ptr, "use_add_character_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
+
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
+ uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NONE);
+ uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
+
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
+ split = uiLayoutSplit(row, 0.7, FALSE);
+ uiItemL(split, "", ICON_NONE); /*Just use this for some spacing */
+ uiItemR(split, ptr, "use_character_jump", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
+ break;
}
}
diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h
index b445d59db2c..7c4772f24e8 100644
--- a/source/blender/makesdna/DNA_actuator_types.h
+++ b/source/blender/makesdna/DNA_actuator_types.h
@@ -277,10 +277,13 @@ typedef struct bActuator {
#define ACT_ANG_VEL_LOCAL 32
//#define ACT_ADD_LIN_VEL_LOCAL 64
#define ACT_ADD_LIN_VEL 64
+#define ACT_ADD_CHAR_LOC 128
+#define ACT_CHAR_JUMP 256
/* objectactuator->type */
-#define ACT_OBJECT_NORMAL 0
-#define ACT_OBJECT_SERVO 1
+#define ACT_OBJECT_NORMAL 0
+#define ACT_OBJECT_SERVO 1
+#define ACT_OBJECT_CHARACTER 2
/* actuator->type */
#define ACT_OBJECT 0
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index b653289e44d..18035acdb63 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -389,6 +389,12 @@ static void rna_ObjectActuator_type_set(struct PointerRNA *ptr, int value)
oa->forcerot[1] = 0.5f;
oa->forcerot[2] = 0.0f;
break;
+
+ case ACT_OBJECT_CHARACTER:
+ memset(oa, 0, sizeof(bObjectActuator));
+ oa->flag = ACT_DLOC_LOCAL | ACT_DROT_LOCAL;
+ oa->type = ACT_OBJECT_CHARACTER;
+ break;
}
}
}
@@ -701,6 +707,7 @@ static void rna_def_object_actuator(BlenderRNA *brna)
static EnumPropertyItem prop_type_items[] = {
{ACT_OBJECT_NORMAL, "OBJECT_NORMAL", 0, "Simple Motion", ""},
{ACT_OBJECT_SERVO, "OBJECT_SERVO", 0, "Servo Control", ""},
+ {ACT_OBJECT_CHARACTER, "OBJECT_CHARACTER", 0, "Character Motion", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -867,6 +874,11 @@ static void rna_def_object_actuator(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Add", "Toggles between ADD and SET linV");
RNA_def_property_update(prop, NC_LOGIC, NULL);
+ prop = RNA_def_property(srna, "use_add_character_location", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_ADD_CHAR_LOC);
+ RNA_def_property_ui_text(prop, "Add", "Toggles between ADD and SET character location");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
+
prop = RNA_def_property(srna, "use_servo_limit_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_X);
RNA_def_property_ui_text(prop, "X", "Set limit to force along the X axis");
@@ -881,6 +893,11 @@ static void rna_def_object_actuator(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_Z);
RNA_def_property_ui_text(prop, "Z", "Set limit to force along the Z axis");
RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+ prop = RNA_def_property(srna, "use_character_jump", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CHAR_JUMP);
+ RNA_def_property_ui_text(prop, "Jump", "Makes the character jump using the settings in the physics properties");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_camera_actuator(BlenderRNA *brna)