diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-09-21 01:33:54 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-09-21 01:33:54 +0400 |
commit | 22a50402efc1fd9b725d7760c90b343e63191ee4 (patch) | |
tree | a37957c7da0b6d4c7d64f6216526a6f3ab5d5834 /source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp | |
parent | 768e12a064cf524a14a84203b100a33235bba30e (diff) |
BGE patch: allow Bullet mesh shape sharing for objects copied with ALT-D.
Diffstat (limited to 'source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index b3f24d97281..6f5f9e22506 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -767,7 +767,17 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, { if (!ci.m_mass) { - shapeInfo->SetMesh(meshobj, false); + // mesh shapes can be shared, check first if we already have a shape on that mesh + class CcdShapeConstructionInfo *sharedShapeInfo = CcdShapeConstructionInfo::FindMesh(meshobj, false); + if (sharedShapeInfo != NULL) + { + delete shapeInfo; + shapeInfo = sharedShapeInfo; + shapeInfo->AddRef(); + } else + { + shapeInfo->SetMesh(meshobj, false); + } bm = shapeInfo->CreateBulletShape(); //no moving concave meshes, so don't bother calculating inertia //bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); |