Revision: 16022
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16022
Author:   ben2610
Date:     2008-08-08 11:57:17 +0200 (Fri, 08 Aug 2008)

Log Message:
-----------
BGE bug #17450 fixed: When we have parented objects with no scale-applyed 
objects the ray hit system doesn't work properly. Fix by separating rotation 
and scaling in the parent inverse node to keep scaling correct down to the leaf 
objects. Only isotropric scaling should be used, as always with the BGE.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp

Modified: trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp      
2008-08-08 09:52:32 UTC (rev 16021)
+++ trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp      
2008-08-08 09:57:17 UTC (rev 16022)
@@ -1939,7 +1939,17 @@
                                float* fl = (float*) blenderobject->parentinv;
                                MT_Transform parinvtrans(fl);
                                
parentinversenode->SetLocalPosition(parinvtrans.getOrigin());
-                               
parentinversenode->SetLocalOrientation(parinvtrans.getBasis());
+                               // problem here: the parent inverse transform 
combines scaling and rotation 
+                               // in the basis but the scenegraph needs 
separate rotation and scaling.
+                               // This is not important for OpenGL (it uses 
4x4 matrix) but it is important
+                               // for the physic engine that needs a separate 
scaling
+                               
//parentinversenode->SetLocalOrientation(parinvtrans.getBasis());
+
+                               // Extract the rotation and the scaling from 
the basis
+                               MT_Matrix3x3 
inverseOrientation(parinvtrans.getRotation());
+                               
parentinversenode->SetLocalOrientation(inverseOrientation);
+                               MT_Matrix3x3 
scale(inverseOrientation.transposed()*parinvtrans.getBasis());
+                               
parentinversenode->SetLocalScale(MT_Vector3(scale[0][0], scale[1][1], 
scale[2][2]));
                                
                                
parentinversenode->AddChild(gameobj->GetSGNode());
                        }


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to