Revision: 16858
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16858
Author:   erwin
Date:     2008-10-01 08:36:17 +0200 (Wed, 01 Oct 2008)

Log Message:
-----------
+ hook up a few more parameters, that can be useful for Bullet soft bodies
+ work-in-progress to hook up cluster constraints (they are better than 
node/vertex pinning, because they maintain a proper world coordinate system)

Modified Paths:
--------------
    trunk/blender/source/blender/src/buttons_logic.c
    trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

Modified: trunk/blender/source/blender/src/buttons_logic.c
===================================================================
--- trunk/blender/source/blender/src/buttons_logic.c    2008-10-01 03:35:53 UTC 
(rev 16857)
+++ trunk/blender/source/blender/src/buttons_logic.c    2008-10-01 06:36:17 UTC 
(rev 16858)
@@ -3004,9 +3004,9 @@
                if (ob->bsoft)
                {
                        xco = 0;
-                       uiDefButF(block, NUMSLI, 0, "LinStiff ", xco, yco, 238, 
19, 
+                       uiDefButF(block, NUMSLI, 0, "LinStiff", xco, yco, 238, 
19, 
                                &ob->bsoft->linStiff, 0.0, 1.0, 1, 0,
-                               "Linear stiffness of the soft body vertex 
spring");
+                               "Linear stiffness of the soft body links");
                        yco -= 25;
                        xco = 0;
 
@@ -3027,9 +3027,35 @@
                                xco+=120, yco, 118, 19, 
&ob->bsoft->collisionflags, 0, 0, 0, 0, 
                                "Enable cluster collision between soft and soft 
body");
                        yco -= 25;
+                       xco = 0;
+                       uiDefButI(block, NUM, REDRAWVIEW3D, "Clus.It.",         
+                               xco, yco, 118, 19, 
&ob->bsoft->numclusteriterations, 1.0, 128., 
+                               0, 0, "Specify the number of cluster 
iterations");
 
+                       uiDefButI(block, NUM, REDRAWVIEW3D, "piterations",      
        
+                               xco+=120, yco, 118, 19, 
&ob->bsoft->piterations, 0, 10, 
+                               0, 0, "Position solver iterations");
+
+                       yco -= 25;
                        xco = 0;
+                       uiDefButF(block, NUMSLI, REDRAWVIEW3D, "Friction",      
        
+                               xco, yco, 118, 19, &ob->bsoft->kDF, 0.0, 1., 
+                               0, 0, "Dynamic Friction");
+
+                       uiDefButF(block, NUMSLI, REDRAWVIEW3D, "kMT",           
+                               xco+=120, yco, 118, 19, &ob->bsoft->kMT, 0, 1,
+                               0, 0, "Pose matching coefficient");
+
+                       /*
+                       //too complex tweaking, disable for now
+                       uiDefButF(block, NUMSLI, REDRAWVIEW3D, "kVC",           
+                               xco+=80, yco, 80, 19, &ob->bsoft->kVC, 0, 100,
+                               0, 0, "Volume coefficient");
+                       */
+
+                       xco = 0;
 /*
+//would be a cool option, like leaves in the wind, need complex tweaking
                        uiDefButBitI(block, TOG, OB_BSB_AERO_VTWOSIDE, 0, "Aero 
model",
                                xco, yco, 118, 19, &ob->bsoft->flag, 0, 0, 0, 0,
                                "Enable aero model, vertex normals are flipped 
to match velocity");
@@ -3037,18 +3063,6 @@
                        yco -= 25;
 */
 
-
-                       
-                       /*
-                       uiDefButF(block, NUMSLI, 0, "AngStiff ", xco, yco, 238, 
19, 
-                       &ob->bsoft->angStiff, 0.0, 1.0, 1, 0, 
-                       "Angular stiffness of the soft body vertex spring");
-                       yco -= 25;
-                       uiDefButF(block, NUMSLI, 0, "Volume ", xco, yco, 238, 
19, 
-                       &ob->bsoft->volume, 0.0, 1.0, 1, 0, 
-                       "Factor of soft body volume preservation");
-                       */
-
                }
 
        } else

Modified: 
trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp    
2008-10-01 03:35:53 UTC (rev 16857)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp    
2008-10-01 06:36:17 UTC (rev 16858)
@@ -1532,13 +1532,56 @@
                int node=findClosestNode(sb0,pivotPointSoftWorld);
                if (node >=0)
                {
-                       if (rb1)
+                       bool clusterconstaint = false;
+/*
+                       switch (type)
                        {
-                               sb0->appendAnchor(node,rb1);
-                       } else
+                       case PHY_LINEHINGE_CONSTRAINT:
+                               {
+                                       if (sb0->clusterCount() && rb1)
+                                       {
+                                               btSoftBody::LJoint::Specs       
ls;
+                                               ls.erp=0.5f;
+                                               ls.position=sb0->clusterCom(0);
+                                               sb0->appendLinearJoint(ls,rb1);
+                                               clusterconstaint = true;
+                                               break;
+                                       }
+                               }
+                       case PHY_GENERIC_6DOF_CONSTRAINT:
+                               {
+                                       if (sb0->clusterCount() && rb1)
+                                       {
+                                               btSoftBody::AJoint::Specs as;
+                                               as.erp = 1;
+                                               as.cfm = 1;
+                                               
as.axis.setValue(axisX,axisY,axisZ);
+                                               sb0->appendAngularJoint(as,rb1);
+                                               clusterconstaint = true;
+                                               break;
+                                       }
+
+                                       break;
+                               }
+                       default:
+                               {
+                               
+                               }
+                       };
+                       */
+
+                       if (!clusterconstaint)
                        {
-                               sb0->setMass(node,0.f);
+                               if (rb1)
+                               {
+                                       sb0->appendAnchor(node,rb1);
+                               } else
+                               {
+                                       sb0->setMass(node,0.f);
+                               }
                        }
+
+                       
                }
                return 0;//can't remove soft body anchors yet
        }
@@ -1549,13 +1592,58 @@
                int node=findClosestNode(sb1,pivotPointAWorld);
                if (node >=0)
                {
-                       if (rb0)
+                       bool clusterconstaint = false;
+
+                       /*
+                       switch (type)
                        {
-                               sb1->appendAnchor(node,rb0);
-                       } else
+                       case PHY_LINEHINGE_CONSTRAINT:
+                               {
+                                       if (sb1->clusterCount() && rb0)
+                                       {
+                                               btSoftBody::LJoint::Specs       
ls;
+                                               ls.erp=0.5f;
+                                               ls.position=sb1->clusterCom(0);
+                                               sb1->appendLinearJoint(ls,rb0);
+                                               clusterconstaint = true;
+                                               break;
+                                       }
+                               }
+                       case PHY_GENERIC_6DOF_CONSTRAINT:
+                               {
+                                       if (sb1->clusterCount() && rb0)
+                                       {
+                                               btSoftBody::AJoint::Specs as;
+                                               as.erp = 1;
+                                               as.cfm = 1;
+                                               
as.axis.setValue(axisX,axisY,axisZ);
+                                               sb1->appendAngularJoint(as,rb0);
+                                               clusterconstaint = true;
+                                               break;
+                                       }
+
+                                       break;
+                               }
+                       default:
+                               {
+                                       
+
+                               }
+                       };*/
+
+
+                       if (!clusterconstaint)
                        {
-                               sb1->setMass(node,0.f);
+                               if (rb0)
+                               {
+                                       sb1->appendAnchor(node,rb0);
+                               } else
+                               {
+                                       sb1->setMass(node,0.f);
+                               }
                        }
+                       
+
                }
                return 0;//can't remove soft body anchors yet
        }


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to