softbody <--> softbody collision

make softbodies collide with objects patented to armatures (bones), lattices .. )

Softbody deflectors always use the new modifier stack. (thanks ZR)

Softbody deflector code checks for identity of colliding objects so,
there is no need to prohibit softbodies to be a deflector.

So now you can put some soft balls in a box and see them bounce.

see : http://wund.privat.t-online.de/bt/sb_sb_coll.blend

A deflector cube parented to SB lattice:
http://wund.privat.t-online.de/bt/sb_lattice.blend

BM
This commit is contained in:
2005-08-16 17:48:47 +00:00
parent 7c539f8ebc
commit 43e329edb7
3 changed files with 11 additions and 3 deletions

View File

@@ -1443,7 +1443,9 @@ int SoftBodyDetectCollision(float opco[3], float npco[3], float colco[3],
fa *= fa;
fa = 1.0f/fa;
copyob = ob;
if (ob->pd->flag & PDEFLE_DEFORM){// get colliding mesh from modifier stack
// if (ob->pd->flag & PDEFLE_DEFORM){// get colliding mesh from modifier stack
// keep this option for debugging but IMHO this is not needed
if (1){// get colliding mesh from modifier stack
if(1) { // so maybe someone wants overkill to collide with subsurfed
dm = mesh_get_derived_deform(copyob, &dmNeedsFree);

View File

@@ -1453,7 +1453,9 @@ int modifiers_isSoftbodyEnabled(Object *ob)
ModifierData *md = modifiers_findByType(ob, eModifierType_Softbody);
/* Softbody not allowed in this situation, enforce! */
if (md && ob->pd && ob->pd->deflect) {
/* if (md && ob->pd && ob->pd->deflect) { */
/* no reason for that any more BM */
if (0) {
md->mode &= ~(eModifierMode_Realtime|eModifierMode_Render|eModifierMode_Editmode);
md = NULL;
}

View File

@@ -1417,7 +1417,9 @@ static void object_panel_deflectors(Object *ob)
uiDefButF(block, NUM, B_DIFF, "Inner:", 160,20,150,20, &pd->pdef_sbift, 0.001, 1.0, 10, 0, "Inner face thickness");
uiDefButF(block, NUM, B_DIFF, "Outer:", 160, 0,150,20, &pd->pdef_sboft, 0.001, 1.0, 10, 0, "Outer face thickness");
uiBlockBeginAlign(block);
/* seems to be working fine .. so we do use modifier stack by default .. code here rests for debugging
uiDefButBitS(block, TOG, PDEFLE_DEFORM , 0,"UMS or CRASH", 0,0,150,20, &pd->flag, 0, 0, 0, 0, "Let collision object move with armatures/lattices WARNING logical circles will CRASH");
*/
}
}
}
@@ -1464,7 +1466,9 @@ static void object_softbodies(Object *ob)
if(uiNewPanel(curarea, block, "Softbody", "Object", 640, 0, 318, 204)==0) return;
/* do not allow to combine with force fields */
if(ob->pd && ob->pd->deflect) {
/* if(ob->pd && ob->pd->deflect) { */
/* no reason for that any more BM */
if(0) {
uiDefBut(block, LABEL, 0, "Object has Deflection,", 10,160,300,20, NULL, 0.0, 0, 0, 0, "");
uiDefBut(block, LABEL, 0, "no Softbody possible", 10,140,300,20, NULL, 0.0, 0, 0, 0, "");
} else {