After revising my code, I saw that I made some mistakes (ah... I'm so
embarrassed). At least, I could manage to make another step! Now the
model seems to mimic me, still, not as fluent as I wanted, but it's
something.
Turn2Euler was an example, it just returns you all three rotations of
a given rotationMatrix. For example, my L_knee in a T-pose has this
matrix (after being multpiplied by its parent's inverse):
| 0.99 0.00 0.14 |
| -0.01 1.00 0.07 |
| -0.14 -0.07 0.99 |
Rotations:
X: -3.81 Y: 8.24 Z: -0.09
I store the rotations in ZXY order, since I've seen in BVH Hierarchy
examples that Joint's channels are like this:
CHANNELS 3 Zrotation Xrotation Yrotation
I've found the following problems:
- When I walked towards the camera, the model didn't go forward but
backwards instead.
- If I lifted my knee so I could see it in front of me with my leg
making a 90º angle, the model would do the same but in the opposite
direction (just as if I moved my foot behind me, making that 90º angle
with my leg).
-> temporary "Solution": I tried to negate the Z position of the root
(the hips) and also, negating all X angle rotations. Now the model
moves forward if I do and lifts its knees in the right direction.
Still, movements are not so fluent, is there a way to improve this?
And by the way, is this solution a good way to do this? Perhaps I'm
overlooking something, I read somewhere in this forum that OpenNI uses
a left handed coordinate system and BVH a right handed coordinate
system, could this be the source of problems?
(the next ones are seen even with this "solution")
- Some rotations are twitching, like suddenly changing its
orientation. When I bend my back towards (like a Chinese salutation),
the legs raise from the ground, as if the model was flying or
something...
- Another problem is the arms, they don't seem to be working good. If
I pose myself as an "I-pose" (with my arms straight and my hands close
to my hips) the model does a T-pose. And if I make a T-pose the model
does an I-pose but with the hands moved forward, separating from the
waist.
I think this is because OpenNI has its initial pose as a T-pose, but
BVH has it as a I-pose. If that's the case this is going to give
another big headache.
I know that my English is not good enough to describe all this... so
'ill attach the .bvh files I'm generating. I start in a T-pose, then
lower my right arm, then my left arm (making an I-pose), then I go to
again to a T-pose and return to the I-pose (with both arms). Next, the
legs are lifted, first right, then left. Finally I bend forward and
walk towards the camera. In the file that hasn't this solution, I
don't know why the left leg turns mad though... not always happens
that (which concerns me a lot...).
I hope we can find a solution. I believe we're close!!
(animation.bvh)
http://dl.dropbox.com/u/5105047/animation.bvh
(animation(without solution).bvh)
http://dl.dropbox.com/u/5105047/animation(without%20solution).bvh