[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25083] trunk/blender/source/blender/ blenkernel/intern/particle_system.c: Bug fix: Verlet integration didn' t work properly with moving particle emitters.

Janne Karhu jhkarh at utu.fi
Wed Dec 2 21:53:28 CET 2009


Revision: 25083
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25083
Author:   jhk
Date:     2009-12-02 21:53:28 +0100 (Wed, 02 Dec 2009)

Log Message:
-----------
Bug fix: Verlet integration didn't work properly with moving particle emitters.
Thanks for mcreamsurfer for reporting and Farsthary for the patch!

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/particle_system.c

Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c	2009-12-02 19:59:57 UTC (rev 25082)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2009-12-02 20:53:28 UTC (rev 25083)
@@ -2267,12 +2267,13 @@
 	EffectedPoint epoint;
 	ParticleKey states[5], tkey;
 	float timestep = psys_get_timestep(sim);
-	float force[3],impulse[3],dx[4][3],dv[4][3];
+	float force[3],impulse[3],dx[4][3],dv[4][3],oldpos[3];
 	float dtime=dfra*timestep, time, pa_mass=part->mass, fac, fra=sim->psys->cfra;
 	int i, steps=1;
 	
 	/* maintain angular velocity */
 	VECCOPY(pa->state.ave,pa->prev_state.ave);
+	VECCOPY(oldpos,pa->state.co);
 
 	if(part->flag & PART_SIZEMASS)
 		pa_mass*=pa->size;
@@ -2399,7 +2400,7 @@
 				VECADDFAC(pa->state.vel,pa->state.vel,force,dtime);
 				VECADDFAC(pa->state.co,pa->state.co,pa->state.vel,dtime);
 
-				VECSUB(pa->state.vel,pa->state.co,pa->prev_state.co);
+				VECSUB(pa->state.vel,pa->state.co,oldpos);
 				mul_v3_fl(pa->state.vel,1.0f/dtime);
 				break;
 		}





More information about the Bf-blender-cvs mailing list