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:
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index ffb39bc0fb6..891cd9b3d85 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -672,19 +672,22 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level)
}
// don't replicate logic now: we assume that the objects in the group can have
// logic relationship, even outside parent relationship
+ // In order to match 3D view, the position of groupobj is used as a
+ // transformation matrix instead of the new position. This means that
+ // the group reference point is 0,0,0
- MT_Point3 newpos = groupobj->NodeGetWorldPosition();
- replica->NodeSetLocalPosition(newpos);
-
- MT_Matrix3x3 newori = groupobj->NodeGetWorldOrientation();
- replica->NodeSetLocalOrientation(newori);
-
// get the rootnode's scale
- MT_Vector3 newscale = groupobj->GetSGNode()->GetRootSGParent()->GetLocalScale();
-
+ MT_Vector3 newscale = groupobj->NodeGetWorldScaling();
// set the replica's relative scale with the rootnode's scale
replica->NodeSetRelativeScale(newscale);
+ MT_Matrix3x3 newori = groupobj->NodeGetWorldOrientation() * gameobj->NodeGetWorldOrientation();
+ replica->NodeSetLocalOrientation(newori);
+
+ MT_Point3 newpos = groupobj->NodeGetWorldPosition() +
+ newscale*(groupobj->NodeGetWorldOrientation() * gameobj->NodeGetWorldPosition());
+ replica->NodeSetLocalPosition(newpos);
+
if (replica->GetPhysicsController())
{
replica->GetPhysicsController()->setPosition(newpos);