Having problem with basic animations/scripting

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
Lymmot
Posts: 4
Joined: Wed Oct 30, 2013 5:20 pm

Having problem with basic animations/scripting

Post by Lymmot »

Hello everybody. :) Hopefully somebody here can help me with this.

I'm using irrlicht to make an animated storytelling game, where characters act out a scene and occasionally the player has a choice of how the story progresses. Unfortunately, I'm a complete amateur at programming/computer graphics and I'm having trouble with character animation.

Currently I'm using Blender to model, rig and animate my characters before exporting them to Blitz3D format. I can then display that animated character in irrlicht without any problems. However, this only lets me display a single looping animation.

Want I want to know is:
-How do I make a model so that it is has several animations in its file?
-How do I select between these animations in irrlicht so that I can make a character do one thing and then another different thing, rather than a single looping animation?


Apologies in advance if this is a dumb question or it's been asked before- I searched as thoroughly as I could before asking.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Having problem with basic animations/scripting

Post by CuteAlien »

You can set the frames between which it loops in IAnimatedMeshSceneNode::setFrameLoop. So if you have several animations in your file you have to write down the frames for each animation and then set the correponding start-end frame which you need.

Don't know yet much about Blender export myself (I just got back into Blender recently and haven't created new animations yet - old script I used for Blender 2.49 no longer works).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Lymmot
Posts: 4
Joined: Wed Oct 30, 2013 5:20 pm

Re: Having problem with basic animations/scripting

Post by Lymmot »

Thanks for the help. So the idea is to just have one long animation per model, but to subdivide it into lots of sub-animations for particular actions? So frames 1-20 would be the walking animation, 20-50 would be idle... etc etc.?

I'll give this a try over the weekend.
tank202
Competition winner
Posts: 40
Joined: Mon Jan 21, 2013 8:34 pm
Location: Lithuania, Kaunas

Re: Having problem with basic animations/scripting

Post by tank202 »

Hello Lymmot,

Welcome to irrlicht community.

Your model file has one timeline in which you put your animations. You can't make separate animations so far as I know. As CuteAlien said you can manipulate the animation by special functions like:
character->setFrameLoop(int start_frame, int end_frame); //it will play only the selected frames
character->setAnimationSpeed(int frames_per_second); // controls animation speed
character->setLoopMode(bool looping); // with this function you can stop the animation

Furthermore I my advice for you would be not to get involved into big project at once but to develop game elements in separate projects... Also you should get the NEW Visual Studio, unless you have one, as it would show you all available functions to you characters... So now you're on your own..
Good luck.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Having problem with basic animations/scripting

Post by CuteAlien »

Yeah - that's the usual way. There's a more complicated way as well by splitting the model and animations in different files and merging them in code again, but that's basically only needed when you want to re-use same animations for different models.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Lymmot
Posts: 4
Joined: Wed Oct 30, 2013 5:20 pm

Re: Having problem with basic animations/scripting

Post by Lymmot »

OK, thank you both. :)
lumirion
Posts: 79
Joined: Tue Sep 13, 2011 7:35 am

Re: Having problem with basic animations/scripting

Post by lumirion »

there is also the option of using a custom animator to read stored individual animations from the mesh and apply them using joint control as shown at http://www.irrlicht3d.org/wiki/index.ph ... tionSystem
Lymmot
Posts: 4
Joined: Wed Oct 30, 2013 5:20 pm

Re: Having problem with basic animations/scripting

Post by Lymmot »

Hello... it's me again. I have another problem that I can't figure out on my own and this time its about scripting. I've put it here because its closely related to my previous questions.

I want to make a program where a sequence of animations runs one after another, like a long cutscene, accompanied by things like moving cameras and audio dialogue playing. Unfortunately my knowledge of C++ is extremely poor and I don't know how to set up an event sequence like this. I can do the individual things like play audio and position character models, but not chaining events together in sequence.

So in short:
How can I make it so that a character completing an action, such as reaching the final frame of its animation or completing movement to a particular position, will trigger the start of another action?

I've seen things like the IAnimationEndCallback interface which might be useful for something like this, but without examples I haven't been able to understand how to use it. :?
Post Reply