I am attempting to write my own .bvh exporter, I think I got the header/hierarchy part working ok as my armature’s rest pose looks fine when imported.
However I am having a lot of trouble calculating the rotations for motion section.
Motion Section Example:
//Header, Hierarchy... MOTION Frames: 3 Frame Time: 0.041667 0.000000 0.000000 0.000000 -0.000000 0.000000 -0.000000 -0.000000 0.000000 -0.000000 -0.000000 0.000000 -0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000 -0.000000 -0.000000 89.999996 0.000000 -0.000000 0.000000 -0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000 -0.000000 -0.000000 89.999996 0.000000 -0.000000 0.000000 -0.000000 0.000000 0.000000 -0.000000 -0.000008 -0.000015 90.000009
What exactly are these values? And how do I calculate them given the bones of my armature (given each bone’s local or global Quaternaion rotations)? Because I realized pretty quickly that those values aren’t simply the local Euler angles of each bone. When I import any of my .bvh animations into blender, they bend in weird ways.
I think I have read that they are some kind of compound angle calculated by multiplying the global rotation matrix of each parent bone in order???
I don’t understand if those angles are compound angles, or the local rotation for each joint.
Basically I have an armature in the Unity GE, and I want to create a .bvh file that contains the rotations of it’s bone’s for each frame so I can then import that animation into Blender using .bvh format.
I am using Quaternions for each bone and get the Euler angles from them to use in the .bvh, but I am not sure if they are going to work, and I have read that the rotations are actually within a homologous coordinate system created by pre-multiplying all parent translation matrices. If this is the case, it’s beyond my current understanding, however I am not sure if that applies to creating the file or just decoding it.
Any help would be a huge relief, I have been struggling to understand this for days.
Also, please excuse my lack of knowledge on this subject!