diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2008-09-25 20:48:25 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2008-09-25 20:48:25 +0400 |
commit | bc28feb997b05d61d2d1e971137be489c780dcbc (patch) | |
tree | 3f6db24ce581c3ae3830352c66bb62773720f802 /source/gameengine | |
parent | c9c9b2e8332786128fa078acb598987a3b419b5c (diff) |
re-use some Blender soft body settings for Bullet game soft bodies
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 19 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 5 |
2 files changed, 17 insertions, 7 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index b3df2d7bc85..5b72a10cd0d 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -129,6 +129,7 @@ #include "DNA_sound_types.h" #include "DNA_key_types.h" #include "DNA_armature_types.h" +#include "DNA_object_force.h" #include "MEM_guardedalloc.h" #include "BKE_utildefines.h" @@ -1323,10 +1324,20 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, objprop.m_angular_rigidbody = (blenderobject->gameflag & OB_RIGID_BODY) != 0; ///for game soft bodies - objprop.m_linearStiffness = blenderobject->linearStiffness; - objprop.m_angularStiffness = blenderobject->angularStiffness; - objprop.m_volumePreservation = blenderobject->volumePreservation; - objprop.m_gamesoftFlag = blenderobject->gamesoftFlag; + if (blenderobject->soft) + { + objprop.m_linearStiffness = blenderobject->soft->inspring; + objprop.m_angularStiffness = 1.f;//blenderobject->angularStiffness; + objprop.m_volumePreservation = 1.f;//blenderobject->volumePreservation; + objprop.m_gamesoftFlag = blenderobject->softflag;//blenderobject->gamesoftFlag; + + } else + { + objprop.m_linearStiffness = 0.5;//blenderobject->linearStiffness; + objprop.m_angularStiffness = 1.f;//blenderobject->angularStiffness; + objprop.m_volumePreservation = 1.f;//blenderobject->volumePreservation; + objprop.m_gamesoftFlag = 1;//blenderobject->gamesoftFlag; + } objprop.m_ghost = (blenderobject->gameflag & OB_GHOST) != 0; objprop.m_disableSleeping = (blenderobject->gameflag & OB_COLLISION_RESPONSE) != 0;//abuse the OB_COLLISION_RESPONSE flag diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 333ecd6ea11..b24ff42a495 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -346,7 +346,6 @@ void CcdPhysicsController::CreateRigidbody() - //pm->m_kAST = 0.01f; //pm->m_kVST = 0.001f; psb->generateBendingConstraints(2,pm); @@ -354,7 +353,7 @@ void CcdPhysicsController::CreateRigidbody() //psb->m_cfg.viterations = 4; //psb->m_cfg.diterations = 4; //psb->m_cfg.citerations = 4; - if (m_cci.m_gamesoftFlag & 1)///OB_SOFT_SHAPE_MATCHING) + if (m_cci.m_gamesoftFlag & 2)//OB_SB_GOAL) { psb->setPose(false,true);// } else @@ -390,7 +389,7 @@ void CcdPhysicsController::CreateRigidbody() //psb->m_materials[0]->m_kLST = 0.1+(i/(btScalar)(n-1))*0.9; psb->setTotalMass(m_cci.m_mass); - //psb->generateClusters(8);//(64); + psb->generateClusters(8);//(64); psb->setCollisionFlags(0); // m_object->setCollisionShape(rbci.m_collisionShape); btTransform startTrans; |