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>2009-05-01 23:02:23 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2009-05-01 23:02:23 +0400
commite13a089d918cbe3709f544ccebbb718a452ac6fa (patch)
tree2b8d3e36659fe11591a981f6e12a9443bbfa2d57 /source/gameengine/Ketsji/KX_Scene.cpp
parent672492f563e148dc608965c5d0011413fbfae0eb (diff)
BGE: work around a problem with DBVT culling when graphic objects are rescaled. This happens when objects with very diverse scale are instantiated with dupligroup. The problem remains when the objects are rescaled during the game. The effect of the problem is an inefficient culling: objects can have a bounding box larger than needed. Patch to fix the problem is filed at Bullet forum.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index fd244037722..36486440c00 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -717,10 +717,13 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level)
// set the orientation after position for softbody!
MT_Matrix3x3 newori = groupobj->NodeGetWorldOrientation() * gameobj->NodeGetWorldOrientation();
replica->NodeSetLocalOrientation(newori);
-
+ // update scenegraph for entire tree of children
replica->GetSGNode()->UpdateWorldData(0);
replica->GetSGNode()->SetBBox(gameobj->GetSGNode()->BBox());
replica->GetSGNode()->SetRadius(gameobj->GetSGNode()->Radius());
+ // we can now add the graphic controller to the physic engine
+ replica->ActivateGraphicController(true,true);
+
// done with replica
replica->Release();
}
@@ -831,6 +834,8 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject,
replica->GetSGNode()->UpdateWorldData(0);
replica->GetSGNode()->SetBBox(originalobj->GetSGNode()->BBox());
replica->GetSGNode()->SetRadius(originalobj->GetSGNode()->Radius());
+ // the size is correct, we can add the graphic controller to the physic engine
+ replica->ActivateGraphicController(true,true);
// now replicate logic
vector<KX_GameObject*>::iterator git;