Raymond
Demo: Green Dragon

Newer: "New animated model format: COLLADA"

Older: "Three.js Model format woes"

Armature animation: extracting bone rotation data

ASSIMP just won't read my COLLADA file. Manually entering values from XML to see if the bone matrix values do anything. If so, can use an XML parser instead of ASSIMP.

First (root) bone from COLLADA XML file:

<COLLADA xmlns="http://www.COLLADA.org/2005/11/COLLADASchema" version="1.4.1">
...
<source id="Armature_Bone_pose_matrix-output">
    <float_array id="Armature_Bone_pose_matrix-output-array" count="32">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0.9937479 -0.111412 0.007234246 0 0.111412 0.9853772 -0.1289153 0 0.007234247 0.1289153 0.9916292 0 0 0 0 1</float_array>
    <technique_common>
      <accessor source="#Armature_Bone_pose_matrix-output-array" count="2" stride="16">
        <param name="TRANSFORM" type="float4x4"/>
      </accessor>
    </technique_common>
  </source>
...

Whelp, you can't reverse-engineer an XYZ-rotation matrix. Can try to use it directly, but that removes quaternion SLERP rotation.

Turns out you can:

R = r11 r12 r13
    r21 r22 r23
    r31 r32 r33

math.atan2(r32,r33)
math.atan2(-(r31),math.sqrt(r32**2+r33**2))
math.atan2(r21, r11)

On testing, I can't get that to work.

[10/04/14 14:24]

OK, can convert rotation matrix to quaternion via glm::toQuat(). Might be able to extract matrices from XML and convert to quaternions for spherical linear interpolation (SLERP).

This has been met with some success, though it is still a bit wonky.

Good enough for animation, let's go.

Newer: "New animated model format: COLLADA"

Older: "Three.js Model format woes"