Forum

Articulate Joints from Mocap

17 August 2017 22:22
Hi Folks !

Im trying to build a sort of mocap player with blend4web… My joint rotation code is something like this :

function rotateBone(rig,boneName,eulerX,eulerY,eulerZ)
{
  var boneInfo= m_armat.get_bone_tsr_rel(rig, boneName);
  var boneInfoInv= m_tsr.invert(m_armat.get_bone_tsr_rel(rig, boneName),m_tsr.create());
  var boneQuat = m_tsr.get_quat_view(boneInfo);
  var boneQuatInv = m_tsr.get_quat_view(boneInfoInv);


  var rotQuatBone=m_util.euler_to_quat([eulerY,eulerX,eulerZ],m_quat.create());
  var finalQuatBone=m_quat.multiply(boneQuatInv,boneQuat,m_quat.create());
  m_quat.multiply(rotQuatBone ,finalQuatBone,finalQuatBone);

  m_tsr.set_quat(finalQuatBone, boneInfo);
  m_armat.set_bone_tsr_rel(rig, boneName,boneInfo);

}


the result of this function applied to the set of the joints gives me something that resemble the original animation …. but its seems that a miss one step in the transformations … can you guys help me to figure what im doing wrong ?
Thanks
Enzo
18 August 2017 02:17
This sounds like a cool project. Can you attach an example project? I think we need to see what your project does, then know what it is supposed to do before we can make any suggestions.
18 August 2017 15:06
Hi Will !

I'm sending the project with the assets and a sample video of the animation I'm trying to play. (Generated from a java application that works with the same file format as the blend4web application is reading).


Thanks for the help !
18 August 2017 15:40
Its a try to port this APP https://www.youtube.com/watch?v=LiCwnfhgiXM
18 August 2017 17:41
I see your video but was unable to run the project. If you use the Export Project button in your Project Manager, it will create a zip file with all files needed for somebody else to import it.
18 August 2017 19:13
Sorry ! Im sending the version generated by export…
19 August 2017 16:26
Okay, I got the project to load. I see your animation when I push the button. Have you considered using Non Linear Animations (NLA)? Each animation can be built in Blender instead of hard-coding all the movement. Then you can move, duplicate and activate any of the animations with your code. If I guess you goal correctly, you want to speak sign language with your character. You could build each 'signed-word' animation in Blender then call it on demand with code.
 
Please register or log in to leave a reply.