Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2011-03-28 12:08:59 +0400
committerJanne Karhu <jhkarh@gmail.com>2011-03-28 12:08:59 +0400
commit72b4bf2fda227ede4f6308f7171c4a74c22f02b8 (patch)
treeb02858fb6d50cb4d569abb2ddbf40e71cb648c9d /source
parentfd72840587bacbb3e5d6964e19c9359e0dd293e9 (diff)
Bug fix: particles emitted from a moving emitter exploded with verlet integration
* Verlet integration didn't like moving emitters, so now the first step for newborn particles with verlet is actually done with euler integration.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/particle_system.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 088ab78ce47..19d4ed598ee 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -2063,10 +2063,15 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
float force[3],acceleration[3],impulse[3],dx[4][3],dv[4][3],oldpos[3];
float pa_mass= (part->flag & PART_SIZEMASS ? part->mass * pa->size : part->mass);
int i, steps=1;
-
+ int integrator = part->integrator;
+
copy_v3_v3(oldpos, pa->state.co);
+
+ /* Verlet integration behaves strangely with moving emitters, so do first step with euler. */
+ if(pa->prev_state.time < 0.f && integrator == PART_INT_VERLET)
+ integrator = PART_INT_EULER;
- switch(part->integrator){
+ switch(integrator){
case PART_INT_EULER:
steps=1;
break;
@@ -2100,7 +2105,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
/* calculate next state */
add_v3_v3(states[i].vel, impulse);
- switch(part->integrator){
+ switch(integrator){
case PART_INT_EULER:
madd_v3_v3v3fl(pa->state.co, states->co, states->vel, dtime);
madd_v3_v3v3fl(pa->state.vel, states->vel, acceleration, dtime);