diff options
Diffstat (limited to 'source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp index 5a13cf5440d..038de1ead10 100644 --- a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp +++ b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp @@ -31,7 +31,7 @@ #include <iostream> - + #include "KX_SG_BoneParentNodeRelationship.h" #include "MT_Matrix4x4.h" @@ -42,7 +42,7 @@ * Implementation of classes defined in KX_SG_BoneParentNodeRelationship.h */ -/** +/** * first of all KX_SG_BoneParentRelation */ @@ -61,7 +61,7 @@ UpdateChildCoordinates( bool& parentUpdated ) { MT_assert(child != NULL); - + // This way of accessing child coordinates is a bit cumbersome // be nice to have non constant reference access to these values. @@ -72,13 +72,13 @@ UpdateChildCoordinates( parentUpdated = true; // the childs world locations which we will update. - + MT_Vector3 child_w_scale; MT_Point3 child_w_pos; MT_Matrix3x3 child_w_rotation; - + bool valid_parent_transform = false; - + if (parent) { BL_ArmatureObject *armature = (BL_ArmatureObject*)(parent->GetSGClientObject()); @@ -88,34 +88,34 @@ UpdateChildCoordinates( if (armature->GetBoneMatrix(m_bone, parent_matrix)) { // Get the child's transform, and the bone matrix. - MT_Matrix4x4 child_transform ( - MT_Transform(child_pos + MT_Vector3(0.0f, armature->GetBoneLength(m_bone), 0.0f), + MT_Matrix4x4 child_transform ( + MT_Transform(child_pos + MT_Vector3(0.0f, armature->GetBoneLength(m_bone), 0.0f), child_rotation.scaled( - child_scale[0], - child_scale[1], + child_scale[0], + child_scale[1], child_scale[2]))); - + // The child's world transform is parent * child parent_matrix = parent->GetWorldTransform() * parent_matrix; child_transform = parent_matrix * child_transform; - + // Recompute the child transform components from the transform. - child_w_scale.setValue( + child_w_scale.setValue( MT_Vector3(child_transform[0][0], child_transform[0][1], child_transform[0][2]).length(), MT_Vector3(child_transform[1][0], child_transform[1][1], child_transform[1][2]).length(), MT_Vector3(child_transform[2][0], child_transform[2][1], child_transform[2][2]).length()); - child_w_rotation.setValue(child_transform[0][0], child_transform[0][1], child_transform[0][2], - child_transform[1][0], child_transform[1][1], child_transform[1][2], + child_w_rotation.setValue(child_transform[0][0], child_transform[0][1], child_transform[0][2], + child_transform[1][0], child_transform[1][1], child_transform[1][2], child_transform[2][0], child_transform[2][1], child_transform[2][2]); child_w_rotation.scale(1.0f/child_w_scale[0], 1.0f/child_w_scale[1], 1.0f/child_w_scale[2]); - + child_w_pos = MT_Point3(child_transform[0][3], child_transform[1][3], child_transform[2][3]); - + valid_parent_transform = true; } } - } - + } + if (valid_parent_transform) { child->SetWorldScale(child_w_scale); |