Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2012-02-05 13:32:35 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2012-02-05 13:32:35 +0400
commit223216a36f0adc23341307042cc4d838b7dde800 (patch)
tree33c62097a6bf0dc9125c5f2fb755f00ff93b2a96 /source/gameengine/Physics/Bullet
parent5e92c4e38125849c5790a14be3d98441afaf2edb (diff)
BGE bug #21947: Softbodies not using object size. Fixed by scaling the shape before creating the soft body.
Diffstat (limited to 'source/gameengine/Physics/Bullet')
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp14
1 files changed, 12 insertions, 2 deletions
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<numverts*3; i+=3)
+ {
+ scaledVertexBase[i] = ((const btScalar*)vertexBase)[i] * localScaling.getX();
+ scaledVertexBase[i+1] = ((const btScalar*)vertexBase)[i+1] * localScaling.getY();
+ scaledVertexBase[i+2] = ((const btScalar*)vertexBase)[i+2] * localScaling.getZ();
+ }
+ psb = btSoftBodyHelpers::CreateFromTriMesh(worldInfo,scaledVertexBase,(const int*)indexbase,numtris,false);
+ delete [] scaledVertexBase;
}
} else
{