diff options
-rw-r--r-- | source/blender/blenkernel/BKE_effect.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 18 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 10 |
3 files changed, 14 insertions, 17 deletions
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index 4d5ab274fc5..a69fc7ef103 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -72,8 +72,7 @@ int pdDoDeflection(float opco[3], float npco[3], float opno[3], int SoftBodyDetectCollision(float opco[3], float npco[3], float colco[3], float facenormal[3], float *damp, float force[3], int mode, - float cur_time, unsigned int par_layer, int *last_object, - int *last_face, int *same_face); + float cur_time, unsigned int par_layer,struct Object *vertexowner); #endif diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 032a376c87f..137feb88046 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -1519,8 +1519,7 @@ int object_wave(Object *ob) int SoftBodyDetectCollision(float opco[3], float npco[3], float colco[3], float facenormal[3], float *damp, float force[3], int mode, - float cur_time, unsigned int par_layer, int *last_object, - int *last_face, int *same_face) + float cur_time, unsigned int par_layer,struct Object *vertexowner) { Base *base; Object *ob, *deflection_object = NULL; @@ -1551,6 +1550,12 @@ int SoftBodyDetectCollision(float opco[3], float npco[3], float colco[3], /*Only proceed for mesh object in same layer */ if(base->object->type==OB_MESH && (base->lay & par_layer)) { ob= base->object; + if((vertexowner) && (ob == vertexowner)){ + /* if vertexowner is given + * we don't want to check collision with owner object */ + base = base->next; + continue; + } /* only with deflecting set */ if(ob->pd && ob->pd->deflect) { def_mesh= ob->data; @@ -1646,9 +1651,9 @@ int SoftBodyDetectCollision(float opco[3], float npco[3], float colco[3], facedist = Inpf(dv1,d_nvect); if ((facedist > innerfacethickness) && (facedist < outerfacethickness)){ //force_mag_norm =ee*(facedist - outerfacethickness)*(facedist - outerfacethickness); - force_mag_norm =exp(-ee*facedist); + force_mag_norm =(float)exp(-ee*facedist); if (facedist > outerfacethickness*ff) - force_mag_norm =force_mag_norm*fa*(facedist - outerfacethickness)*(facedist - outerfacethickness); + force_mag_norm =(float)force_mag_norm*fa*(facedist - outerfacethickness)*(facedist - outerfacethickness); force[0] += force_mag_norm*d_nvect[0] ; force[1] += force_mag_norm*d_nvect[1] ; @@ -1680,9 +1685,9 @@ int SoftBodyDetectCollision(float opco[3], float npco[3], float colco[3], facedist = Inpf(dv1,d_nvect); if ((facedist > innerfacethickness) && (facedist < outerfacethickness)){ //force_mag_norm =ee*(facedist - outerfacethickness)*(facedist - outerfacethickness); - force_mag_norm =exp(-ee*facedist); + force_mag_norm =(float)exp(-ee*facedist); if (facedist > outerfacethickness*ff) - force_mag_norm =force_mag_norm*fa*(facedist - outerfacethickness)*(facedist - outerfacethickness); + force_mag_norm =(float)force_mag_norm*fa*(facedist - outerfacethickness)*(facedist - outerfacethickness); force[0] += force_mag_norm*d_nvect[0] ; force[1] += force_mag_norm*d_nvect[1] ; @@ -1750,7 +1755,6 @@ int SoftBodyDetectCollision(float opco[3], float npco[3], float colco[3], } // while (base) if (mode == 1){ // face - last_object = deflection_object; return deflected; } diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 15f4e77048d..95d877b1aad 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -300,9 +300,6 @@ static void Vec3PlusStVec(float *v, float s, float *v1) static int sb_deflect_face(Object *ob,float *actpos, float *futurepos,float *collisionpos, float *facenormal,float *force,float *cf ,float *bounce) { int deflected; - int last_ob = -1; - int last_fc = -1; - int same_fc = 0; float s_actpos[3], s_futurepos[3]; SoftBody *sb= ob->soft; // is supposed to be there VECCOPY(s_actpos,actpos); @@ -313,7 +310,7 @@ static int sb_deflect_face(Object *ob,float *actpos, float *futurepos,float *col deflected= SoftBodyDetectCollision(s_actpos, s_futurepos, collisionpos, facenormal, cf, force , 1, - G.scene->r.cfra, ob->lay, &last_ob, &last_fc, &same_fc); + G.scene->r.cfra, ob->lay, ob); return(deflected); } @@ -322,9 +319,6 @@ static int sb_deflect_face(Object *ob,float *actpos, float *futurepos,float *col static int sb_deflect_edge_face(Object *ob,float *actpos, float *futurepos,float *collisionpos, float *facenormal,float *slip ,float *bounce) { int deflected; - int last_ob = -1; - int last_fc = -1; - int same_fc = 0; float dummy[3],s_actpos[3], s_futurepos[3]; SoftBody *sb= ob->soft; // is supposed to be there VECCOPY(s_actpos,actpos); @@ -335,7 +329,7 @@ static int sb_deflect_edge_face(Object *ob,float *actpos, float *futurepos,float deflected= SoftBodyDetectCollision(s_actpos, s_futurepos, collisionpos, facenormal, dummy, dummy , 2, - G.scene->r.cfra, ob->lay, &last_ob, &last_fc, &same_fc); + G.scene->r.cfra, ob->lay, ob); return(deflected); } |