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>2008-09-21 02:19:59 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2008-09-21 02:19:59 +0400
commita72b65011e826342eaf9620413714fbbf1a1d872 (patch)
tree7171dcb9606e90778102b63627eeb5e88c1ef465
parent22a50402efc1fd9b725d7760c90b343e63191ee4 (diff)
BGE bug fix: dupligroup scale not correctly applied to bullet shape.
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp23
2 files changed, 10 insertions, 23 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 252741754ec..15055a9cf93 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -823,7 +823,17 @@ void KX_GameObject::NodeSetLocalScale(const MT_Vector3& scale)
void KX_GameObject::NodeSetRelativeScale(const MT_Vector3& scale)
{
if (GetSGNode())
+ {
GetSGNode()->RelativeScale(scale);
+ if (m_pPhysicsController1 && (!GetSGNode()->GetSGParent()))
+ {
+ // see note above
+ // we can use the local scale: it's the same thing for a root object
+ // and the world scale is not yet updated
+ MT_Vector3 newscale = GetSGNode()->GetLocalScale();
+ m_pPhysicsController1->setScaling(newscale);
+ }
+ }
}
void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans)
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 72875bbc039..04db96c298c 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -694,17 +694,6 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level)
newscale*(groupobj->NodeGetWorldOrientation() * gameobj->NodeGetWorldPosition());
replica->NodeSetLocalPosition(newpos);
- if (replica->GetPhysicsController())
- {
- // not required, already done in NodeSetLocalOrientation..
- //replica->GetPhysicsController()->setPosition(newpos);
- //replica->GetPhysicsController()->setOrientation(newori.getRotation());
- // Scaling has been set relatively hereabove, this does not
- // set the scaling of the controller. I don't know why it's just the
- // relative scale and not the full scale that has to be put here...
- replica->GetPhysicsController()->setScaling(newscale);
- }
-
replica->GetSGNode()->UpdateWorldData(0);
replica->GetSGNode()->SetBBox(gameobj->GetSGNode()->BBox());
replica->GetSGNode()->SetRadius(gameobj->GetSGNode()->Radius());
@@ -829,18 +818,6 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject,
// set the replica's relative scale with the rootnode's scale
replica->NodeSetRelativeScale(newscale);
- if (replica->GetPhysicsController())
- {
- // not needed, already done in NodeSetLocalPosition()
- //replica->GetPhysicsController()->setPosition(newpos);
- //replica->GetPhysicsController()->setOrientation(newori.getRotation());
- replica->GetPhysicsController()->setScaling(newscale);
- }
-
- // here we want to set the relative scale: the rootnode's scale will override all other
- // scalings, so lets better prepare for it
-
-
replica->GetSGNode()->UpdateWorldData(0);
replica->GetSGNode()->SetBBox(originalobj->GetSGNode()->BBox());
replica->GetSGNode()->SetRadius(originalobj->GetSGNode()->Radius());