From 551806bce89c142ac731651637dc9f240d9c2302 Mon Sep 17 00:00:00 2001 From: Kester Maddock Date: Mon, 13 Dec 2004 09:53:30 +0000 Subject: Set the physics scale on added objects. (Fix bug #1837) --- source/gameengine/Ketsji/KX_Scene.cpp | 12 +++++++----- source/gameengine/Physics/Sumo/SumoPhysicsController.cpp | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 26825fe5e1f..09e4ae7bbb1 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -600,21 +600,23 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject, MT_Matrix3x3 newori = ((KX_GameObject*) parentobject)->NodeGetWorldOrientation(); replica->NodeSetLocalOrientation(newori); + + // get the rootnode's scale + MT_Vector3 newscale = parentobj->GetSGNode()->GetRootSGParent()->GetLocalScale(); + + // set the replica's relative scale with the rootnode's scale + replica->NodeSetRelativeScale(newscale); if (replica->GetPhysicsController()) { 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 - // get the rootnode's scale - MT_Vector3 newscale = parentobj->GetSGNode()->GetRootSGParent()->GetLocalScale(); - - // set the replica's relative scale with the rootnode's scale - replica->NodeSetRelativeScale(newscale); replica->GetSGNode()->UpdateWorldData(0); replica->GetSGNode()->SetBBox(originalobj->GetSGNode()->BBox()); diff --git a/source/gameengine/Physics/Sumo/SumoPhysicsController.cpp b/source/gameengine/Physics/Sumo/SumoPhysicsController.cpp index 5301e125ce1..46eeef264de 100644 --- a/source/gameengine/Physics/Sumo/SumoPhysicsController.cpp +++ b/source/gameengine/Physics/Sumo/SumoPhysicsController.cpp @@ -174,7 +174,8 @@ void SumoPhysicsController::setPosition(float posX,float posY,float posZ) void SumoPhysicsController::setScaling(float scaleX,float scaleY,float scaleZ) { - m_sumoObj->setScaling(MT_Vector3(scaleX,scaleY,scaleZ)); + if (!m_bDyna) + m_sumoObj->setScaling(MT_Vector3(scaleX,scaleY,scaleZ)); } // physics methods -- cgit v1.2.3