Add child joint to existing skeleton at runtime

Started by Tangomajom, January 18, 2017, 11:06:12 AM

Previous topic - Next topic

Tangomajom

Hi Raft,

After a long time I'm back again with an interesting question. :)

Is it possible to "extend" the skeleton of an Animated3D object with an extra child bone?

Let me explain the reason of this question:
As you may remember I'm working on a fitness application, and I have an animated Male who can show various exercises. The human body can move correctly thanks to JPCT and your library. :)
Now I would like to modify my code to let the human grab and lift objects (barbells, chains, kettlebells etc.).

Here is my plan:
1. create the movable objects in blender with only 1 bone, which affects the whole mesh.
2. export the objects with the ogre exporter (Just like I did with the Male body), and import the .bones file to my android project
3. after loading I would like to add the movable objects single bone to the Male body skeleton as a child of the hand bone.

If this is possible then I just need to animate only the human body, and the accessories will follow the linked bone.
Step 1 and 2 is easy, but with step 3 I need your help. Is it possible to connect the object like this way?

Thank you in advance,


raft

hey!

nope, not possible with current state of api. you can change the code or use reflection to add a joint to skeleton. however I'm not sure math will follow what you intend to do.

I will suggest attaching your movable object to skeleton at blender and export the male body and object as a group, separate objects but both are linked to same skeleton. at run time you can show/hide your object. (not sure if possible with blender exporter, but anyway)

see the ninja demo, it's exported as a group and ninja holds a sword at his hand which can be shown/hidden but follows ninja's animation.