diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2009-04-27 20:44:02 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2009-04-27 20:44:02 +0400 |
commit | 352eaccd5d991ad8966d686ae0954c7a0b03345c (patch) | |
tree | 40151c894e6b681ee158b8da72361b76bfa6447e /source/gameengine | |
parent | c56ee09c48b4d29dabe1c7daa2133777c27944f6 (diff) |
BGE: Add soft body welding parameter to the Advanced Settings panel. The values are very small so I chose to use logarithmic scale. Should be fine, it's an advanced setting after all.
Diffstat (limited to 'source/gameengine')
4 files changed, 13 insertions, 5 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 962af7cc4c9..b330515c0d3 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1418,6 +1418,10 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, objprop.m_soft_kAHR= blenderobject->bsoft->kAHR; /* Anchors hardness [0,1] */ 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*/ + if (blenderobject->bsoft->welding == 0.f) + objprop.m_soft_welding = 0.0001f; /* welding */ + else + objprop.m_soft_welding = pow(10.f,blenderobject->bsoft->welding); /* welding */ } else { @@ -1457,6 +1461,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, objprop.m_soft_kAHR= 0.7f; objprop.m_soft_collisionflags= OB_BSB_COL_SDF_RS + OB_BSB_COL_VF_SS; objprop.m_soft_numclusteriterations= 16; + objprop.m_soft_welding = 0.0001f; } } diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h index 3534500e619..40c715974f9 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h @@ -124,6 +124,7 @@ struct KX_ObjectProperties float m_soft_kAHR; /* Anchors hardness [0,1] */ int m_soft_collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */ int m_soft_numclusteriterations; /* number of iterations to refine collision clusters*/ + float m_soft_welding; /* threshold to remove duplicate/nearby vertices */ ///////////////////////// diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index be3b758a14b..1943c436258 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -905,7 +905,9 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, // Soft bodies require welding. Only avoid remove doubles for non-soft bodies! if (objprop->m_softbody) - shapeInfo->setVertexWeldingThreshold1(0.0001f); //todo: expose this to the UI + { + shapeInfo->setVertexWeldingThreshold1(objprop->m_soft_welding); //todo: expose this to the UI + } bm = shapeInfo->CreateBulletShape(); //no moving concave meshes, so don't bother calculating inertia diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 297d3048a3a..53c2d6c7937 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -462,11 +462,11 @@ void KX_GameObject::RemoveMeshes() void KX_GameObject::UpdateTransform() { - if (m_pPhysicsController1) - // only update the transform of static object, dynamic object are handled differently - // note that for bullet, this does not even update the transform of static object + // HACK: saves function call for dynamic object, they are handled differently + if (m_pPhysicsController1 && !m_pPhysicsController1->IsDyna()) + // Note that for Bullet, this does not even update the transform of static object // but merely sets there collision flag to "kinematic" because the synchronization is - // done differently during physics simulation + // done during physics simulation m_pPhysicsController1->SetSumoTransform(true); if (m_pGraphicController) // update the culling tree |