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
path: root/source
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-08-08 13:57:17 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2008-08-08 13:57:17 +0400
commit62f9ba67c0970ef6a7fa2a9feae4784a94d675dc (patch)
tree2faebed0d894fa5a0516c8a45564933bd210ba5d /source
parentfa98def953f714057882017310d71d5ffb4a332b (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index f44318120e8..a6337403cd1 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1939,7 +1939,17 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
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());
}