Fix for [#28823] Boids use uninitialized memory.
authorJanne Karhu <jhkarh@gmail.com>
Sat, 15 Oct 2011 01:42:26 +0000 (01:42 +0000)
committerJanne Karhu <jhkarh@gmail.com>
Sat, 15 Oct 2011 01:42:26 +0000 (01:42 +0000)
* Boids need the random velocity vector always.

source/blender/blenkernel/intern/particle_system.c

index 6b601ed4b1afdbd359d9f6b88b1ac079d9dd6557..7b2d621aff25d2bfdbcfca41f1f888d06de9657e 100644 (file)
@@ -1607,8 +1607,8 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
        }
                
 
-       /* -velocity                                                    */
-       if(part->randfac != 0.0f){
+       /* -velocity (boids need this even if there's no random velocity) */
+       if(part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)){
                r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f);
                r_vel[1] = 2.0f * (PSYS_FRAND(p + 11) - 0.5f);
                r_vel[2] = 2.0f * (PSYS_FRAND(p + 12) - 0.5f);