Animate a Character
Animate a Character
Does anyone know how to animate a character by loading animations form a file? I am a newbie. I know I can load an animated mesh, but I want to be able to load a mesh with bones, load some files containing animation information (collada for example, or bvh) and then play the appropriate animation by name, as needed. For example (this is totally pseudocode):
mesh->Load("Soldier.X");
mesh->LoadAnimation("Walk.bvh");
mesh->LoadAnimation("Stand.bvh");
mesh->LoadAnimation("Run.bvh");
and thed activate each animation using:
mesh->PlayAnimation("Walk.bvh");
Thank you for your help!
mesh->Load("Soldier.X");
mesh->LoadAnimation("Walk.bvh");
mesh->LoadAnimation("Stand.bvh");
mesh->LoadAnimation("Run.bvh");
and thed activate each animation using:
mesh->PlayAnimation("Walk.bvh");
Thank you for your help!
currently not possible, you'll have to load the animations as separate meshes and copy the positions and rotations of the bones across manually each frame.
To do this, see-
http://www.irrlicht3d.org/wiki/index.ph ... tionSystem
To do this, see-
http://www.irrlicht3d.org/wiki/index.ph ... tionSystem
hmm so its quite hardcore to make an RPG like game on irrlicht like:
- Separate meshes for each body part like armor,gloves,helm etc.
- All body parts connected to player skeleton
- All body parts are animated by player skeleton only
- Player can have for example 200 different animations
It seems to be impossible without totally custom mesh/skeleton loading and own animation engine. Am i wrong ?
- Separate meshes for each body part like armor,gloves,helm etc.
- All body parts connected to player skeleton
- All body parts are animated by player skeleton only
- Player can have for example 200 different animations
It seems to be impossible without totally custom mesh/skeleton loading and own animation engine. Am i wrong ?
Im trying to make a game character be able to wear something like an Armor but im completely lost here and don't really know where to start and how to arrange this. Is seems to be a little complicated for me ... BUT i really want to learn and do it. Someday i would have to anyway so ...
Can someone "guide" me a little how to load couple of meshes for example a box and sphere and attach them to the same already existing skeleton ?
Maybe there is other a better way to do what i want to do ?
I hope someone can understand this
Can someone "guide" me a little how to load couple of meshes for example a box and sphere and attach them to the same already existing skeleton ?
Maybe there is other a better way to do what i want to do ?
I hope someone can understand this
The problem is i dont want to attach as a child.
Child attach is good but for weapons in hands and i know about that.
I want to "switch" the player Torso to Armor and use the same skeleton as the Torso and attach the Armor to proper joints as defined in the Armor model.
Both models Torso and Armor have included the same player skeleton.
Its like to build a player model from a separate body parts attached to a one global skeleton and then replace them by other one .... like to change the torso body part to armor body part.
More Visual (virtual code) example :
player -> setSkeleton ( "skeleton.skl" );
player -> setTorsoMesh ( "torso.x" );
...
player -> setTorsoMesh ( "armor.x" );
torso.x and armor.x have the skeleton.skl included as the basic skeleton so all the models "know" to whitch bone all the triangles should be attached to.
I think solution is to use a custom Mesh Node with couple of Vertex buffers and render each buffer separately with separate texture.
Child attach is good but for weapons in hands and i know about that.
I want to "switch" the player Torso to Armor and use the same skeleton as the Torso and attach the Armor to proper joints as defined in the Armor model.
Both models Torso and Armor have included the same player skeleton.
Its like to build a player model from a separate body parts attached to a one global skeleton and then replace them by other one .... like to change the torso body part to armor body part.
More Visual (virtual code) example :
player -> setSkeleton ( "skeleton.skl" );
player -> setTorsoMesh ( "torso.x" );
...
player -> setTorsoMesh ( "armor.x" );
torso.x and armor.x have the skeleton.skl included as the basic skeleton so all the models "know" to whitch bone all the triangles should be attached to.
I think solution is to use a custom Mesh Node with couple of Vertex buffers and render each buffer separately with separate texture.
-
xifeng4487
- Posts: 1
- Joined: Thu Feb 14, 2008 5:42 am
you can't do it
your problem is my problem. we can use the OGRE model format --- "mesh" and "skeleton" to do it . But the irrlicht has a lot of bugs in "mesh" load and do nothing with the "skeleton"!!! God! I must do it myself. faint!
ogre is only for static meshes at the moment, it isn't supported by Irrlicht's SkinnedMesh.
The simplest and easiest way to do this would be to read tutorial 3 and make a custom scene node - for example CClothingSceneNode, make it add a child as an animated mesh then in the OnAnimate method, copy the joint positions from the node's parent and apply them to the joints with the same name in your clothing node.
Then adding clothes is as simple as creating a CClothingSceneNode for each item.
The simplest and easiest way to do this would be to read tutorial 3 and make a custom scene node - for example CClothingSceneNode, make it add a child as an animated mesh then in the OnAnimate method, copy the joint positions from the node's parent and apply them to the joints with the same name in your clothing node.
Then adding clothes is as simple as creating a CClothingSceneNode for each item.
Is on Irrlidht some BuiltIn method to get all the Node Joints ? (enumerate)
Because it seems that i need to get all the Joints of all the Submeshes and set each one position and rotation by hand like :
playerArmor -> getJointNode ( "Torso01" );
or
playerArmor -> getJointNode ( 0 );
The best method i think is to create a Loop with :
playerArmor -> getJointNode ( i );
i++;
BUT how to get the Joints count or all the Joints Names / IDs ?
I know that getJointNode returns 0 if no Joint found but what if a mesh have non sorted Joint IDs like 1,5,3,2,8,12 ? It should return 0 if i try to get Joint 4 and its correct but how to figure out is there any Joint left ?
BTW.
Its quite stupid to make the "JointChildSceneNodes" private
and do not make any copyJoints / getJoints / setJoints / useRemoteJoints methods :/ ... maybe i should start thinking about Irrlicht source modifications.
Solution seems to be quite easy:
-Replace the Joints array by pointer to JointsArray.
-If is defined a pointer then use the remote JointsArray and act as a Ragdoll ... if not then act as a common node with local JointsArray.
It should make the Node to animate by the same skeleton as the parent is without setting each child skeleton separately and copying it.
Second solution is to just copy the CAnimatedMeshSceneNode as CBodyPartMeshSceneNode and make it a brand new node.
It could be nice to add multifile animations support by the way (bvh,smd).
What do you guys think about that ?
Because it seems that i need to get all the Joints of all the Submeshes and set each one position and rotation by hand like :
playerArmor -> getJointNode ( "Torso01" );
or
playerArmor -> getJointNode ( 0 );
The best method i think is to create a Loop with :
playerArmor -> getJointNode ( i );
i++;
BUT how to get the Joints count or all the Joints Names / IDs ?
I know that getJointNode returns 0 if no Joint found but what if a mesh have non sorted Joint IDs like 1,5,3,2,8,12 ? It should return 0 if i try to get Joint 4 and its correct but how to figure out is there any Joint left ?
BTW.
Its quite stupid to make the "JointChildSceneNodes" private
and do not make any copyJoints / getJoints / setJoints / useRemoteJoints methods :/ ... maybe i should start thinking about Irrlicht source modifications.
Solution seems to be quite easy:
-Replace the Joints array by pointer to JointsArray.
-If is defined a pointer then use the remote JointsArray and act as a Ragdoll ... if not then act as a common node with local JointsArray.
It should make the Node to animate by the same skeleton as the parent is without setting each child skeleton separately and copying it.
Second solution is to just copy the CAnimatedMeshSceneNode as CBodyPartMeshSceneNode and make it a brand new node.
It could be nice to add multifile animations support by the way (bvh,smd).
What do you guys think about that ?
QUAKE 2 accomplishes just that
With quake2 (md2 files) you can do something very close to that.. so
IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh )
node->setMD2Animation ( scene::EMAT_RUN ); // or stand or whatever
not quite BVH in separate files, but very close
IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh )
node->setMD2Animation ( scene::EMAT_RUN ); // or stand or whatever
not quite BVH in separate files, but very close
-
hybrid
- Admin
- Posts: 14144
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
The animations stored are not separate animations, but animation sequences which are all put sequentially into one large animation. You can then choose an interval from that large animation to play.
The idea of using a separate set of weights sounds interesting. If there is a way to implement this efficiently it might be worth considering it. Just prepare an implementation and show your results.
Also note that the joint API provides something called useAnimationFrom. I don't know exactly what it does, but you might use it already now to achieve the desired effect.
I'll move this thread to the advanced section to avoid it getting lost.
The idea of using a separate set of weights sounds interesting. If there is a way to implement this efficiently it might be worth considering it. Just prepare an implementation and show your results.
Also note that the joint API provides something called useAnimationFrom. I don't know exactly what it does, but you might use it already now to achieve the desired effect.
I'll move this thread to the advanced section to avoid it getting lost.
3DS Max Plugin
I was looking at the MD2 format and it should be doable. I do need to get more comfortable with Irrlicht.
Do any of you know of a good plug in to go from 3DSMax 9 to MP2? Not sure I like QTip.
Do any of you know of a good plug in to go from 3DSMax 9 to MP2? Not sure I like QTip.