diff options
-rw-r--r-- | source/blender/makesdna/DNA_object_force.h | 1 | ||||
-rw-r--r-- | source/blender/src/buttons_logic.c | 10 | ||||
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 3 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 6 |
4 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index e8e865a533c..dc449a64c6d 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -120,6 +120,7 @@ typedef struct BulletSoftBody { int collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */ int numclusteriterations; /* number of iterations to refine collision clusters*/ float welding; /* welding limit to remove duplicate/nearby vertices, 0.0..0.01 */ + float margin; /* margin specific to softbody */ } BulletSoftBody; /* BulletSoftBody.flag */ diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c index 2cda73eaef3..2f8933b593b 100644 --- a/source/blender/src/buttons_logic.c +++ b/source/blender/src/buttons_logic.c @@ -3141,8 +3141,14 @@ static uiBlock *advanced_bullet_menu(void *arg_ob) uiBlockEndAlign(block); yco -= 20; xco = 0; - uiDefButF(block, NUMSLI, 0, "Welding ", - xco, yco, 360, 19, &ob->bsoft->welding, 0.f, 0.01f, 10, 4, + if (ob->bsoft->margin < 0.001f) + ob->bsoft->margin = 0.25f; + uiDefButF(block, NUM, 0, "Margin", + xco, yco, 180, 19, &ob->bsoft->margin, 0.001, 1.0, 1, 0, + "Collision margin for soft body. Small value makes the algorithm unstable"); + + uiDefButF(block, NUM, 0, "Welding ", + xco+=180, yco, 180, 19, &ob->bsoft->welding, 0.f, 0.01f, 10, 4, "Welding threshold: distance between nearby vertices to be considered equal => set to 0.0 to disable welding test and speed up scene loading (ok if the mesh has no duplicates)"); /* diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index d4cc047d5e3..13aac74edca 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1456,7 +1456,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, objprop.m_soft_collisionflags= blenderobject->bsoft->collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */ objprop.m_soft_numclusteriterations= blenderobject->bsoft->numclusteriterations; /* number of iterations to refine collision clusters*/ objprop.m_soft_welding = blenderobject->bsoft->welding; /* welding */ - + objprop.m_margin = blenderobject->bsoft->margin; } else { objprop.m_gamesoftFlag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT; @@ -1496,6 +1496,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, objprop.m_soft_collisionflags= OB_BSB_COL_SDF_RS + OB_BSB_COL_VF_SS; objprop.m_soft_numclusteriterations= 16; objprop.m_soft_welding = 0.f; + objprop.m_margin = 0.f; } } diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 7302c47f4bf..6b00011b693 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -296,7 +296,11 @@ void CcdPhysicsController::CreateRigidbody() } } - + if (m_cci.m_margin > 0.f) + { + psb->getCollisionShape()->setMargin(m_cci.m_margin); + psb->updateBounds(); + } m_object = psb; |