diff options
author | Jens Ole Wund <bjornmose@gmx.net> | 2008-01-12 04:26:40 +0300 |
---|---|---|
committer | Jens Ole Wund <bjornmose@gmx.net> | 2008-01-12 04:26:40 +0300 |
commit | 1610b55f7ef3c0ffa74e088f5321afd8ed2da6fa (patch) | |
tree | 388eb94f96010847ecd222513738b01103e0ff23 /source/blender/blenkernel/intern/softbody.c | |
parent | e8a200eb042a38ee4ea9a2a309b546ff611b79dc (diff) |
nice little thing -> have angular response on 'aero'
made backward compatible for sure
Diffstat (limited to 'source/blender/blenkernel/intern/softbody.c')
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 6fde920ff7a..a48dc4ae0bd 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1510,14 +1510,20 @@ void scan_for_ext_spring_forces(Object *ob,float timenow) } f = Normalize(vel); f = -0.0001f*f*f*sb->aeroedge; - /* todo add a nice angle dependant function */ - /* look up one at bergman scheafer */ + /* (todo) add a nice angle dependant function done for now BUT */ + /* still there could be some nice drag/lift function, but who needs it */ VECSUB(sp, sb->bpoint[bs->v1].pos , sb->bpoint[bs->v2].pos); Projf(pr,vel,sp); VECSUB(vel,vel,pr); Normalize(vel); - Vec3PlusStVec(bs->ext_force,f,vel); + if (ob->softflag & OB_SB_AERO_ANGLE){ + Normalize(sp); + Vec3PlusStVec(bs->ext_force,f*(1.0f-ABS(Inpf(vel,sp))),vel); + } + else{ + Vec3PlusStVec(bs->ext_force,f,vel); // to keep compatible with 2.45 release files + } } /* --- springs seeing wind */ } @@ -2252,15 +2258,7 @@ static void softbody_calc_forces(Object *ob, float forcetime, float timenow, int float defforce[3]; do_deflector = sb_detect_aabb_collisionCached(defforce,ob->lay,ob,timenow); } -/* - if (do_selfcollision ){ - float ce[3]; - VecMidf(ce,sb->scratch->aabbmax,sb->scratch->aabbmin); - for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) { - bp->octantflag = set_octant_flags(ce,bp->pos,bp->colball); - } - } -*/ + for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) { /* clear forces accumulator */ bp->force[0]= bp->force[1]= bp->force[2]= 0.0; |