From 223216a36f0adc23341307042cc4d838b7dde800 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Sun, 5 Feb 2012 09:32:35 +0000 Subject: BGE bug #21947: Softbodies not using object size. Fixed by scaling the shape before creating the soft body. --- source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source/gameengine/Physics/Bullet') diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 22aa781ebc2..4b3e2ea33a3 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -231,6 +231,8 @@ bool CcdPhysicsController::CreateSoftbody() if (trimeshshape->getMeshInterface()->getNumSubParts()==1) { unsigned char* vertexBase; + btScalar* scaledVertexBase; + btVector3 localScaling; PHY_ScalarType vertexType; int numverts; int vertexstride; @@ -238,8 +240,16 @@ bool CcdPhysicsController::CreateSoftbody() int indexstride; PHY_ScalarType indexType; trimeshshape->getMeshInterface()->getLockedVertexIndexBase(&vertexBase,numverts,vertexType,vertexstride,&indexbase,indexstride,numtris,indexType); - - psb = btSoftBodyHelpers::CreateFromTriMesh(worldInfo,(const btScalar*)vertexBase,(const int*)indexbase,numtris,false); + localScaling = scaledtrimeshshape->getLocalScaling(); + scaledVertexBase = new btScalar[numverts*3]; + for (int i=0; i