Fix for [#18017] reactor particles affected by a curve guide emit at a wrong position.
authorJanne Karhu <jhkarh@gmail.com>
Sat, 4 Apr 2009 12:48:40 +0000 (12:48 +0000)
committerJanne Karhu <jhkarh@gmail.com>
Sat, 4 Apr 2009 12:48:40 +0000 (12:48 +0000)
source/blender/blenkernel/intern/particle_system.c

index 7bda29ebcaf670d4079a457edae63f37285c5bc8..2728addeddd23199240ee8b79ba445cfd1cf3a48 100644 (file)
@@ -1734,6 +1734,8 @@ void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifi
                VECSUB(p_vel,pa->r_ve,p_vel);
                Normalize(p_vel);
                VecMulf(p_vel,speed);
+
+               VECCOPY(pa->fuv,loc); /* abusing pa->fuv (not used for "from particle") for storing emit location */
        }
        else{
                /* get precise emitter matrix if particle is born */
@@ -2483,7 +2485,12 @@ static void precalc_effectors(Object *ob, ParticleSystem *psys, ParticleSystemMo
                                ec->locations=MEM_callocN(totpart*3*sizeof(float),"particle locations");
 
                                for(p=0,pa=psys->particles; p<totpart; p++, pa++){
-                                       psys_particle_on_emitter(psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,0,0,0,0,0);
+                                       if(part->from == PART_FROM_PARTICLE) {
+                                               VECCOPY(loc, pa->fuv);
+                                       }
+                                       else
+                                               psys_particle_on_emitter(psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,0,0,0,0,0);
+
                                        Mat4MulVecfl(ob->obmat,loc);
                                        ec->distances[p]=VecLenf(loc,vec);
                                        VECSUB(loc,loc,vec);