2016-08-22 105 views
1

最近我剛剛讀了介紹了3D遊戲編程與Directx 11,我試圖用第25章中的例子來加載我自己的模型。所以在我蒙皮模型和導出數據在.fbx格式中,我嘗試加載骨骼和動畫數據並得到錯誤的結果。因此,使用assimp加載fbx動畫數據

1.我只是將偏移矩陣複製到我自己的結構中並轉置它,這樣好嗎?

for (auto & s: names) 
{ 
    auto index = maps[s]; 
    auto m = matrixmaps[s]; 
    memcpy(offset.float1d, m, sizeof(float)* 16); 
    TransposeMatrix(offset); 
    Offsets[index] = offset; 
} 

2.I發現根骨骼(Bip001)具有零關鍵幀,所以我檢查加載的數據assimp的節點層次結構,我注意到骨骼層次只是如下:

|_RootNode 
     |_Bip001_$AssimpFbx$_Translation 
     |_Bip001_$AssimpFbx$_PreRotation 
      |_Bip001_$AssimpFbx$_Rotation 
      |_Bip001_$AssimpFbx$_Scaling 
       |_Bip001 
       |_Bip001 Footsteps 
       |_Bip001 Pelvis 
        |_Bip001 Spine 
        |_Bip001 Spine1 
        | |_Bip001 Spine2 
        | |_Bip001 Spine3 
        |  |_Bip001 Neck 
        |  |_Bip001 L Clavicle 
        |  | |_Bip001 L UpperArm 
        |  | |_Bip001 L Forearm 
        |  |  |_Bip001 L Hand 
        |  |  |_Bip001 L Finger0 
        |  |   |_Bip001 L Finger0Nub 
        |  |_Bip001 R Clavicle 
        |  | |_Bip001 R UpperArm 
        |  | |_Bip001 R Forearm 
        |  |  |_Bip001 R Hand 
        |  |  |_Bip001 R Finger0 
        |  |   |_Bip001 R Finger0Nub 
        |  |_Bip001 Head 
        |   |_Bip001 HeadNub 
        |_Bip001 L Thigh 
        | |_Bip001 L Calf 
        | |_Bip001 L Foot 
        |  |_Bip001 L Toe0 
        |  |_Bip001 L Toe01 
        |   |_Bip001 L Toe02 
        |   |_Bip001 L Toe0Nub 
        |_Bip001 R Thigh 
         |_Bip001 R Calf 
         |_Bip001 R Foot 
          |_Bip001 R Toe0 
          |_Bip001 R Toe01 
           |_Bip001 R Toe02 
           |_Bip001 R Toe0Nub 

我應該如何處理節點Bip001的父節點,我應該將這些節點的位置鍵,旋轉鍵和縮放鍵複製到Bip001中? 請幫我弄清楚,非常感謝。

回答

0

對於第二個問題,將AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS設置爲false對我有效。