Page 1 of 1

How to integrate a realtime animation?

Posted: Wed Apr 06, 2005 11:52 am
by markus
Hello,
I'm working on a VR project using irrlicht.
I've already integrated the P5 data glove represented by a static model of a hand.
So right now the hand can be moved in x,y,z achsis and also rotated around them.

Now i want to introduce the bending of the fingers.
So whenever a finger is bend in the glove,
its 3D representation should also bend.

How could this realtime animation be done by irrlicht?

Any ideas welcome.

Greetings
Markus

Posted: Wed Apr 06, 2005 12:58 pm
by Guest
Bones (joints).

You can use Milkshape models for that. Milkshape isn't the only format that supports it, but I think currently it's the only one where you can access the joints through Irrlicht's API.

Posted: Thu Apr 07, 2005 11:17 am
by markus
Hi,
thanks for the reply.
Can you please be a little more specific?
How can one access those joints through the API?
I know this is the advanced forum, but a little code snippet could be extremely helpful. :wink:

Greetings
Markus

Posted: Thu Apr 07, 2005 11:48 am
by Guest
Well, I'd love to give you some working example code with Irrlicht, but I don't have it.

The function you want to use is probably:
virtual core::matrix4* irr::scene::IAnimatedMeshMS3D::getMatrixOfJoint ( s32 jointNumber,
s32 frame
) [pure virtual]

Returns a pointer to a transformation matrix of a part of the mesh based on a frame time. This is used for being able to attach objects to parts of animated meshes. For example a weapon to an animated hand.
Since it returns a pointer, you should be able to modify the actual matrix. I think you should be able to just use frame 0. But I'm not sure if these matrices are applied in sequence, or if the matrices are the "real-world" matrices.
What I mean by that is this: say you have an arm with an elbow, a wrist, and a fixed hand (for simplicity of the explanation).
I don't know if the matrix for the wrist contains the position and angles of the hand in the real-world (after the elbow rotation has been applied), or relative to the lower arm.

I'm actually surpirsed that there is no simple setJointRotation function for this sort of stuff. Irrlicht seems to be purely geared toward pre-baked animations.

Posted: Thu Apr 07, 2005 2:10 pm
by djceejay
You could just construct the hand using a hierarchy of test nodes (boxes) and scaling them.

Code: Select all

Forearm
   Hand
     Thumb lower
         Thumb end
     Finger 1
         Finger 1 end
     Finger 2
         Finger 2 end

etc.
If you add a node with the previous as it's parent (the parent of Hand is Forearm, the parent of Thumb lower is Hand etc.). Then when you move or rotate the hand all it's children will move accordingly. If you got this to work then you could implement joint restrictions - the hand can only rotate so far.