BGE: Fix T46302: abort call for unnormalized quaterions.
authorPorteries Tristan <republicthunderbolt9@gmail.com>
Thu, 1 Oct 2015 11:05:16 +0000 (13:05 +0200)
committerPorteries Tristan <republicthunderbolt9@gmail.com>
Thu, 1 Oct 2015 11:06:57 +0000 (13:06 +0200)
source/gameengine/Converter/BL_ArmatureObject.cpp

index 74ebdbcf1b5a7d9a1579accae3fe407fcc82b680..3d863bf380af6cd505d59e24be1c40021527c5d9 100644 (file)
@@ -176,6 +176,10 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode
                        
                        copy_qt_qt(dquat, dchan->quat);
                        copy_qt_qt(squat, schan->quat);
+                       // Normalize quaternions so that interpolation/multiplication result is correct.
+                       normalize_qt(dquat);
+                       normalize_qt(squat);
+
                        if (mode==BL_Action::ACT_BLEND_BLEND)
                                interp_qt_qtqt(dchan->quat, dquat, squat, srcweight);
                        else {