diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py index c2bc761d39c..88e8f4d4a71 100644 --- a/release/scripts/ui/properties_particle.py +++ b/release/scripts/ui/properties_particle.py @@ -512,6 +512,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel): col = row.column() col.label(text="Misc:") col.prop(boids, "bank", slider=True) + col.prop(boids, "pitch", slider=True) col.prop(boids, "height", slider=True) if part.physics_type == 'KEYED' or part.physics_type == 'BOIDS' or part.physics_type == 'FLUID': diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 5bf228b2392..e408f73e6c8 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -1386,7 +1386,9 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) /* save direction to state.ave unless the boid is falling */ /* (boids can't effect their direction when falling) */ if(bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1*pa->size) { - normalize_v3_v3(pa->state.ave, pa->state.vel); + copy_v3_v3(pa->state.ave, pa->state.vel); + pa->state.ave[2] *= bbd->part->boids->pitch; + normalize_v3(pa->state.ave); } /* apply damping */ @@ -1471,6 +1473,7 @@ void boid_default_settings(BoidSettings *boids) boids->landing_smoothness = 3.0f; boids->banking = 1.0f; + boids->pitch = 1.0f; boids->height = 1.0f; boids->health = 1.0f; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d2b1b2d7010..25af3faa069 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -11107,6 +11107,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } + { + ParticleSettings *part; + for(part = main->particle.first; part; part = part->id.next) { + if(part->boids) + part->boids->pitch = 1.0f; + } + } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */ diff --git a/source/blender/makesdna/DNA_boid_types.h b/source/blender/makesdna/DNA_boid_types.h index 8584b5f99e9..c4324612aff 100644 --- a/source/blender/makesdna/DNA_boid_types.h +++ b/source/blender/makesdna/DNA_boid_types.h @@ -187,8 +187,8 @@ typedef struct BoidState { typedef struct BoidSettings { int options, last_state_id; - float landing_smoothness, rt; - float banking, height; + float landing_smoothness, height; + float banking, pitch; float health, aggression; float strength, accuracy, range; diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 3afa135d079..8cd6fcbeff9 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -480,6 +480,12 @@ static void rna_def_boid_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Banking", "Amount of rotation around velocity vector on turns"); RNA_def_property_update(prop, 0, "rna_Boids_reset"); + prop= RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "pitch"); + RNA_def_property_range(prop, 0.0, 2.0); + RNA_def_property_ui_text(prop, "Pitch", "Amount of rotation around side vector"); + RNA_def_property_update(prop, 0, "rna_Boids_reset"); + prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 2.0); RNA_def_property_ui_text(prop, "Height", "Boid height relative to particle size");