Help animating .X models

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Ryoga2k
Posts: 21
Joined: Mon May 03, 2004 6:59 pm
Location: Asturias, Spain

Help animating .X models

Post by Ryoga2k »

Hi,

I'm using .X animated models to show into the scene the main characters of a game I'm developing using Irrlicht. My .X files contain several animations organized in several animation sets, each of them identified by a string name.

When loading the models, I call the irr::scene::ISceneManager::getMesh function to obtain the IAnimatedMesh pointer. Then I use it to call the irr::scene::ISceneManager::addAnimatedMeshSceneNode function to add the SceneNode. Up to this point, everything is ok.

Problems start when I want to set the current animation for a specific SceneNode. As I want to do it using the name of the animation, I guess I should use the irr::scene::IAnimatedMeshX::setCurrentAnimation method.

As I only can acces to the IAnimatedMeshSceneNode (because I don´t keep a pointer to the IAnimatedMesh when I load the .X file), how can I access to the IAnimatedMesh asociated to my IAnimatedSceneNode? Is there any other simpler way to do this?

Thx. :wink:
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

This code is from Hello world tutorial, you may look at it:

node->setFrameLoop(0, 310);

this loops animation between frames specified. It works with x models as well.
Ryoga2k
Posts: 21
Joined: Mon May 03, 2004 6:59 pm
Location: Asturias, Spain

Post by Ryoga2k »

Yes, I already knew the irr::scene::IAnimatedMeshSceneNode::setFrameLoop method. However it requires knowing the begin and end frame numbers of each animation, and the .X file must contain all the frames in one big animation.

Perhaps I didn´t explain very well what I mean. What I want is to activate an animation calling it by its name (i.e. "Walk", "Stand", "Run", ...), cause the animations in my .X files are stored in that way.

If it were .MD2 files, I could activate them calling to irr::scene::IAnimatedMeshSceneNode::setMD2Animation (directly from the SceneNode), but it doesn't exist a similar method for .X files.

So there is irr::scene::IAnimatedMeshX::setCurrentAnimation which lets to activate an animation stored in an .X model. As long as I know, when you call this method over an IAnimatedMeshX, all the IAnimatedMeshSceneNodes asociated to the mesh displays the new animation.

The problem is that the only moment I have access to de IAnimatedMesh is when I load the model. I wanna know if there is any method in IAnimatedMeshSceneNode (or any other way) to get the Mesh I previously loaded at any moment I want to set a new animation.

Greetz :wink:
gothikal1
Posts: 3
Joined: Mon Jun 07, 2004 6:36 pm
Location: Tucson Arizona
Contact:

Post by gothikal1 »

try the md2 animation functiona. Just because it says md2 doesn't mean it wont work. I remember lots of times that I would use a specific function in a language that was meant for a certain file type and it worked. Just try it.
This guy's outa' control!!!!
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

yep, it works (I read that in the other thread..) But it has quite a lot of quality problems, compared with x. Or even with md3.


Now, if wanna keep artists unhappy..hehe.
Finally making games again!
http://www.konekogames.com
Ryoga2k
Posts: 21
Joined: Mon May 03, 2004 6:59 pm
Location: Asturias, Spain

Post by Ryoga2k »

You mean call the setMD2Animation method although the loaded model is a .X instead of MD2?? Does it really work with .X files?
"There's always a way, if desire meets courage"
Conan of Cimmeria
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

Hmm. I'll have to try and see if it works. I doubt it would do so flawlessly. Would it be that hard to keep a pointer to the mesh? It might be possible towrite a function for IAnimatedMeshSceneNode to acces the .x aniamtions but would probably be hard.
Post Reply