0
\$\begingroup\$

I've downloaded BVH animations and projected it following a book. I can now see a 3D moving rig and it looks alright. The problem is, now I want to plug a sword on the hand of the rig, but I don't know which direction it should face. That is because each vertex has a rotation and an offset, so I can calculate their positions, but there is no information available about their normals. How is this done?

Pseudocode of the position finding procedure for illustration

calculate_position(bone)
     local = bone.rotation_x * bone.rotation_y * bone.rotation_z # matrices
     local[3] = bone.offset_x
     local[7] = bone.offset_y
     local[11] = bone.offset_z
     global = local * bone.parent.global
     return [global[3], global[7], global[11]]
\$\endgroup\$
1
\$\begingroup\$

I believe it is pretty common to use a bone just to represent the weapon, and pull the rotation from that. Alternative you would keep an extra vertex so you can determine the direction. Depending on what they are holding you might be able to use a fixed rotation from the hand's bone rotation.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.