(C++) MD2 non-looping animations

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
cyberwan
Posts: 40
Joined: Mon May 14, 2007 12:18 pm
Location: Rennes, France

(C++) MD2 non-looping animations

Post by cyberwan »

Hi !
I'm dealing with MD2 animated meshes, and here is my "problem" :
I have a character which can hit others with a bat. Therefore, it has two named animations : "hit_begin" and "hit_end". The first one begins with the character's arm up, and ends with the arm down. The second one is off course the opposite. I'm playing both the animations with callbacks mechanism, and that works quite good.
My present problem is the following : when loading the mesh to irrlicht, it generates interpolated frames, so that the animation can be looped. But when I use setMD2Animation, every interpolated frame of the animation is played, even the 3 last frames, which make the arm "jump" because its position is not the same at the end and at the beginning of the animation.
I can fix this problem by getting the frames corresponding to the specified animation, and then use setFrameLoop to play every frame but the last 3. That works fine, but it does not appear clean to me.
I then suggest to add an argument to the setMD2Animation method, to specify if the last 3 frames are to be displayed :

Code: Select all

virtual bool 	setMD2Animation (const c8 *animationName)=0
->
virtual bool 	setMD2Animation (const c8 *animationName, bool isLoopingAnimation=true)=0
This way, one could specify easily if the last 3 frames are to be played. The compatibility with old code is kept, setting a default true value to the argument.
I then would like to know if this idea is good, or if someone has an other "clean" idea to do the same thing.
I can provide a patch to implement this if necessary, the changes would not be enormous...
Thanks for your answers !
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I think this post is better suited for the bug forum, so I'll move it.
It seems reasonable to make this thing configurable in some way. Maybe the new animation system will already have some means to do this.
cyberwan
Posts: 40
Joined: Mon May 14, 2007 12:18 pm
Location: Rennes, France

Post by cyberwan »

hybrid wrote:Maybe the new animation system will already have some means to do this.
Maybe it will, but when is it gonna be released... ?
Post Reply