forked from bartvdbraak/blender
Fix for bug #11114: boids physics went wrong when the distance between
particles was exactly 0.0, for example with emission from verts.
This commit is contained in:
parent
d2fcba7f65
commit
916120b98c
@ -3770,10 +3770,12 @@ static void boid_brain(BoidVecFunc *bvf, ParticleData *pa, Object *ob, ParticleS
|
|||||||
near=0;
|
near=0;
|
||||||
for(n=1; n<neighbours; n++){
|
for(n=1; n<neighbours; n++){
|
||||||
if(ptn[n].dist<2.0f*pa->size){
|
if(ptn[n].dist<2.0f*pa->size){
|
||||||
bvf->Subf(dvec,pa->state.co,pars[ptn[n].index].state.co);
|
if(ptn[n].dist!=0.0f) {
|
||||||
bvf->Mulf(dvec,(2.0f*pa->size-ptn[n].dist)/ptn[n].dist);
|
bvf->Subf(dvec,pa->state.co,pars[ptn[n].index].state.co);
|
||||||
bvf->Addf(avoid,avoid,dvec);
|
bvf->Mulf(dvec,(2.0f*pa->size-ptn[n].dist)/ptn[n].dist);
|
||||||
near++;
|
bvf->Addf(avoid,avoid,dvec);
|
||||||
|
near++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* ptn[] is distance ordered so no need to check others */
|
/* ptn[] is distance ordered so no need to check others */
|
||||||
else break;
|
else break;
|
||||||
|
Loading…
Reference in New Issue
Block a user