How to discover an animation in a 3d model (example: gun.x)?

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
stash
Posts: 47
Joined: Wed Dec 12, 2007 11:28 am
Location: Brasil, SC

How to discover an animation in a 3d model (example: gun.x)?

Post by stash »

Hey guys..

I would to use a existing 3D model (I know that is animated).. But, when I use them, how can I find the first and last frame of the animation and what is the animation speed? Can I find this information by programming? Irrlicht have a method who show me these data ?

Please, help me...

Sorry my ugly english, but this is my question.

Thanks.
Seven
Posts: 1030
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

IAnimatedMeshSceneNode

Code: Select all

		//! Returns the current displayed frame number.
		virtual f32 getFrameNr() const = 0;
		//! Returns the current start frame number.
		virtual s32 getStartFrame() const = 0;
		//! Returns the current end frame number.
		virtual s32 getEndFrame() const = 0;
not sure how to see how many are there if you dont already know though.... lemme look around....
stash
Posts: 47
Joined: Wed Dec 12, 2007 11:28 am
Location: Brasil, SC

Post by stash »

thanks Seven..

I have a new question: Can my example gun.x 3D model file have more than one animation? (example: shot, reload). If yes, how can I retrieve the "names" of animations or the frame numbers between any animation, or the start/end of any animation?

Thanks.
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

Your gun or whatever model can have whatever animation you want, but you need to create it (animate the model). All your questions related to the frames, speed etc. are quite weird. Usually you create the model with its animations and export them as a whole sequence. Like if you have character animations say:
a) idle 1-24
b) walk 25-49
c) run 50-74
d) attack 75-100

It`s exported as one whole sequence with frames 1-100, and you need to play the animation loop between the frames and set speed using the functions Seven already posted (browse the functions of IAnimatedMeshSceneNode).

Like for playing run animation:

Code: Select all

node->setFrameLoop(50, 74);
If you have different files idle.x, walk.x etc. You combine them in one whole sequence to be used in Irrlicht via some modelling program.

EDIT: It`s all in the Irrlicht examples- take a look. If you want to use an animated model, which animation start and end frames you don`t know, you can easily create some code to change the start and end frames when keys were pressed and display them on screen- after a bit of "looking for the right combination" you write them down and you`re done.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
pippy3
Posts: 155
Joined: Tue Dec 15, 2009 7:32 am

Post by pippy3 »

stash
Posts: 47
Joined: Wed Dec 12, 2007 11:28 am
Location: Brasil, SC

Post by stash »

Thanks boys... now, my problem is that the 3d Model gun.x file wasn´t model by me.. and I know that is animated because I´d see it no DirectX Viewer.. but I don´t know how many animations and, what are de range of frames to any animation..

Well, now I need to test..
Seven
Posts: 1030
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

i understand the dilema. You have models but dont know the frame numebrs for each. I once wrote a small app that let me use a scrollbar to manually move through the animations and then i wrote them down. worked fine but i cant seem to find the app for you. should be 'fairly' easy to write i think. if i get time i will make one for you. not sure about my time tonight though. we'll see.
stash
Posts: 47
Joined: Wed Dec 12, 2007 11:28 am
Location: Brasil, SC

Post by stash »

Thanks Seven, but I´ll be write a application to discover the frame numbers.. thanks a lot!
Post Reply