[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16640] trunk/blender/source/gameengine/ Ketsji: BGE bug fix: dupligroup scale not correctly applied to bullet shape .

Benoit Bolsee benoit.bolsee at online.be
Sun Sep 21 00:19:59 CEST 2008


Revision: 16640
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16640
Author:   ben2610
Date:     2008-09-21 00:19:59 +0200 (Sun, 21 Sep 2008)

Log Message:
-----------
BGE bug fix: dupligroup scale not correctly applied to bullet shape.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
    trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2008-09-20 21:33:54 UTC (rev 16639)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2008-09-20 22:19:59 UTC (rev 16640)
@@ -823,7 +823,17 @@
 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)

Modified: trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp	2008-09-20 21:33:54 UTC (rev 16639)
+++ trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp	2008-09-20 22:19:59 UTC (rev 16640)
@@ -694,17 +694,6 @@
 			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 @@
 	// 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());





More information about the Bf-blender-cvs mailing list