How to manipulate limbs of 3d model programmatically?

How to manipulate limbs of 3d model programmatically?
0

Although most people animate a 3d model by “playing” an animation, we would like to manipulate each limb programmatically.

For example, if we wanted to rotate the knee joint, programmatically, we would like to be able to access the appropriate bone and set an angle to rotate it, and have all child bones (such as the foot and toes), also having their orientation changed programmatically.

Likewise, if we moved the upper leg, the lower leg should also move appropriately.

Every frame, we want to be able to set the orientation of several bones:

  1. Head
  2. Neck,
  3. Spine (3 bones)
  4. Upper Legs
  5. Lower Legs
  6. Feet
  7. Upper Arms
  8. Lower Arms
  9. Wrists
  10. Fingers.

Is there a way to do this programmatically rather than playing animations ? Can someone provide us with any example code ? We are looking to manipulate a 3d model of a skeleton, and basically move all bones in the skeleton programmatically.

have you looked in cpp-tests yet?

Yes, I looked at the examples, but there doesn’t seem to be one where you can specifically manipulate any limb or body parts orientation programmatically. If I’m not wrong, they all use animations.

Have I missed something ?

but aren’t you using joints?

Actually although we’ve done a lot of 2d programming, but We’ve never used cocos2d-x for 3d programming. So don’t know what you mean.

Is there an example using joints ? We saw lots of examples using animations, but nothing specifically manipulating a joint… Can you explain ?

I haven’t used 3d a lot either so I would need to work this through as well. Let me review cpp-tests first when I can tomorrow.

Thanks very much! This seems like something that should be really easy to do, but haven’t found any example anywhere. Would really appreciate your help.

I looked around the API, the closest class instance I thoguht best resembled an individual limb manipulation system would be Bone3D

Any idea how to use it? If someone had some sample code it would be really useful!!

Any luck ?

It is good idea to have this opportunity. But if to see further it would be greate to have also the following linked things:

  1. Scale individual bones. This allow to implement simple customisation of NPC.
  2. To implement also inverse kinematic. For example you change the child bone position and its parent bone position is changed also. There should be provided some restricitions for bones to forbid them to accept some not appropriate angles (not natural angles for the body).
    This is just thinking out loud. The second point is really complicated to have it good viewing. But the first should be more possible.