forked from bartvdbraak/blender
Bug fix: Verlet integration didn't work properly with moving particle emitters.
Thanks for mcreamsurfer for reporting and Farsthary for the patch!
This commit is contained in:
parent
63fc267929
commit
47b457f19e
@ -2267,12 +2267,13 @@ static void apply_particle_forces(ParticleSimulationData *sim, int p, float dfra
|
||||
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 @@ static void apply_particle_forces(ParticleSimulationData *sim, int p, float dfra
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user