diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-08-21 19:19:54 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-08-21 19:19:54 +0400 |
commit | e912ca9331d7f9637664e4588bdb72b0ebe76e5c (patch) | |
tree | 1e0c5acf6c732223c9daf4fc3505c9dbd5d5c2e2 /source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | |
parent | 4b9f5b2710fd90946dd378d3f004ddfd6e09cfb9 (diff) |
BGE bug #17491 fixed: BGE, Dupli instance with different scale, massive slowdown.
The root cause of this bug is the fact that Bullet shapes
are shared between duplicated game objects. As the physics
object scale is stored in the shape, all duplicas must
have the same scale otherwise the physics representation
is incorrect.
This fix introduces a mechanism to duplicate shapes at
runtime so that Bullet shapes are not shared anymore.
The drawback is an increased memory consuption.
A reference count mechanism will be introduced in a
later revision to keep Bullet shape shared between
duplicas that have the same scale.
Diffstat (limited to 'source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp')
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index dfbcf115fd7..d8e05fab839 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -1370,8 +1370,9 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl PHY_IPhysicsController* CcdPhysicsEnvironment::CreateConeController(float coneradius,float coneheight) { CcdConstructionInfo cinfo; - //This is a memory leak: Bullet does not delete the shape and it cannot be added to - //the KX_Scene.m_shapes list -- too bad but that's not a lot of data + + // we don't need a CcdShapeConstructionInfo for this shape: + // it is simple enough for the standard copy constructor (see CcdPhysicsController::GetReplica) cinfo.m_collisionShape = new btConeShape(coneradius,coneheight); cinfo.m_MotionState = 0; cinfo.m_physicsEnv = this; |