2

Blender からアニメーションをエクスポートしようとしています。これまでに行ったことは次のとおり
です。
--- わかりにくい場合や必要な場合は、ソース全体を投稿できます。

# Get the armature  
arm = ob.getData()  
# Start at the root bone  
for bone in bones:  
    if not bone.parent:  
        traceBone(bone)  

def traceBone(bone):
  # Get the channel for this bone
  channel=action.getChannelIpo(bone.name);

  # Get the loc x, y, z channels
  c_locx=channel[Ipo.OB_LOCX].bezierPoints
  frameCount=len(c_locx)

  # Write each location frame
  for frameIndex in  range(frameCount):
    frame_x=c_locx[frameIndex].pt
    frameTime=int(frame_x[0]-1)
    # Write the time of the frame
    writeInt(frameTime)
    # Write the x, y and z coordinates
    writeFloats(frame_x[1], frame_z[1], frame_y[1])

  # Iv'e done the same for rotation
  c_quatx=channel[Ipo.PO_QUATX].bezierPoints
  # Write the quaternion w, x, y and z values
  writeFloats(frame_w[1], frame_x[1], frame_z[1], frame_y[1])

  # Go through the children
  for child in bone.children:
    traceBone(child)  

私が知る限り、これはすべて正常に機能します。問題は、これらの値が変化を表すオフセットであることですが、必要なのは、ボーンの位置と親に対するボーンの回転値を表す絶対値です。

親に対する位置と回転を取得するにはどうすればよいですか?

4

1 に答える 1

2

チャネル データは、バインド ポーズ マトリックスの上に適用する必要があります。

完全な式は次のとおりです。

Mr = Ms * B0*P0 * B1*P1 ... Bn*Pn

どこ:

Mr = ボーン 'n' の結果行列

Ms = スケルトン -> ワールド マトリックス

Bi = ボーン 'i' のバインド ポーズ マトリックス

Pi = 格納されたチャネル (エクスポートするもの) から構築された実際の行列をポーズします。

「n-1」は「n」の親ボーン、「n-2」は「n-1」の親、...、「0」は「1」の親

于 2009-11-04T20:37:17.347 に答える