Fix rotation problem#5
Conversation
The rotation was calculated as: r.multLocal(rz).multLocal(rx).multLocal(ry); Since it seems the order of the rotation matters, and it is specified in the bvh file, this line did not take that in account. The proposed fix multiplies it in the order presented in the file.
|
I'll test this in my fork. |
|
The BVH documentation specifies the order of rotation, so perhaps the order of presentation shouldn't matter:
|
|
All my test cases present the rotations in Z-X-Y order. Where did you find a BVH using a different order? |
|
I test the one here: https://sites.google.com/a/cgspeed.com/cgspeed/motion-capture/3dsmax-friendly-release-of-cmu-motion-database These files have both "Zrotation Yrotation Xrotation" and "Zrotation Xrotation Yrotation" within the same file. |
|
I confirmed that 01_01.bvh uses different axis orders for different bones. Then I tried loading 01_01.bvh both ways: using the classic/fixed axis order currently in this project and also with the axis order presented in the CHANNELS headers. I expected to perceive a clear difference between the resulting animations. I expected one axis order to give plausible animation and the other to give garbage. But in fact both animations looked fine. I'm puzzled. Perhaps I screwed up in my testing. Or perhaps there's something going on that I don't understand. |
|
I was testing on the animations 09_**.bvh... eg 09_10.bvh |
|
09_10.bvh also looks fine with either axis order. Still puzzled. |
|
Let me make sure we are on the same page. I ran TestBVHAnimation.java for file 09_10.bvh obtained from cgspeed 3ds Max friendly version. You can see a difference in leg motion. To see it more clearly, move/align your camera in front of the character. |
|
Ah. I was expecting something less subtle. |

The rotation was calculated as:
r.multLocal(rz).multLocal(rx).multLocal(ry);
Since it seems the order of the rotation matters, and it is specified in the bvh file, this line did not take that in account.
The proposed fix multiplies it in the order presented in the file.