diff options
author | Jorge Bernal <jbernalmartinez@gmail.com> | 2015-02-19 01:24:02 +0300 |
---|---|---|
committer | Jorge Bernal <jbernalmartinez@gmail.com> | 2015-02-19 01:24:02 +0300 |
commit | 5d0696052a00ca80043852ca891b1bbe0b70ff1b (patch) | |
tree | bbc455ac8d262452748e1a220fa2277351ac15b3 /source/blender | |
parent | bd5154bb2c642d09b95ff8a2d71e404faa6f6f84 (diff) |
BGE: Fix T41502 Path following jumping
New Lock Z velocity parameter was added. This parameter avoid the micro-jumping.
By default it is actived except when you load an old file that it is deactived to keep former behaviour.
Additionally it was solved another issue related with the acceleration: That is the acceleration value was not taked into account and we had always the maximum linear velocity from the beginning of movement. Now the acceleration is taken into account until we reach the maximum velocity.
When you load an old file, the acceleration value is set to the maximum range (1000.f). This way we simulate a maximum velocity constant from the beginning of movement (former behaviour).
{F142195}
Reviewers: moguri, dfelinto, campbellbarton
Reviewed By: campbellbarton
Subscribers: sergey
Differential Revision: https://developer.blender.org/D1074
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/sca.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_270.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_logic/logic_window.c | 9 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_actuator_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_actuator.c | 5 |
5 files changed, 25 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 9159c9e9afc..c902659c039 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -496,7 +496,7 @@ void init_actuator(bActuator *act) sta->turnspeed = 120.f; sta->dist = 1.f; sta->velocity= 3.f; - sta->flag = ACT_STEERING_AUTOMATICFACING; + sta->flag = ACT_STEERING_AUTOMATICFACING | ACT_STEERING_LOCKZVEL; sta->facingaxis = 1; break; case ACT_MOUSE: diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 1afdc348c24..f4591e4d107 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -616,5 +616,17 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } + + if (!DNA_struct_elem_find(fd->filesdna, "bSteeringActuator", "float", "acceleration")) { + for (ob = main->object.first; ob; ob = ob->id.next) { + bActuator *act; + for (act = ob->actuators.first; act; act = act->next) { + if (act->type == ACT_STEERING) { + bSteeringActuator *sact = act->data; + sact->acceleration = 1000.f; + } + } + } + } } } diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 37c634672df..7204144ce85 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -2105,12 +2105,15 @@ static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr) } row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "self_terminated", 0, NULL, ICON_NONE); + col = uiLayoutColumn(row, false); + uiItemR(col, ptr, "self_terminated", 0, NULL, ICON_NONE); if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING) { - uiItemR(row, ptr, "update_period", 0, NULL, ICON_NONE); - row = uiLayoutRow(layout, false); + col = uiLayoutColumn(row, false); + uiItemR(col, ptr, "update_period", 0, NULL, ICON_NONE); } row = uiLayoutRow(layout, false); + uiItemR(row, ptr, "lock_z_velocity", 1, NULL, ICON_NONE); + row = uiLayoutRow(layout, false); uiItemR(row, ptr, "show_visualization", 0, NULL, ICON_NONE); if (RNA_enum_get(ptr, "mode") != ACT_STEERING_PATHFOLLOWING) { uiLayoutSetActive(row, false); diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index bdf1b62646d..9af0c1dac10 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -570,6 +570,7 @@ typedef struct bActuator { #define ACT_STEERING_ENABLEVISUALIZATION 2 #define ACT_STEERING_AUTOMATICFACING 4 #define ACT_STEERING_NORMALUP 8 +#define ACT_STEERING_LOCKZVEL 16 /* mouseactuator->type */ #define ACT_MOUSE_VISIBILITY 0 diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 6f2c968764c..83a6d728d80 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -2056,6 +2056,11 @@ static void rna_def_steering_actuator(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_NORMALUP); RNA_def_property_ui_text(prop, "N", "Use normal of the navmesh to set \"UP\" vector"); RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop = RNA_def_property(srna, "lock_z_velocity", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_LOCKZVEL); + RNA_def_property_ui_text(prop, "Lock Z velocity", "Disable simulation of linear motion along Z axis"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_mouse_actuator(BlenderRNA *brna) |