Animations /2 Questions

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
BAD_ANGEL
Posts: 5
Joined: Thu Nov 09, 2006 7:39 pm
Location: Germany

Animations /2 Questions

Post by BAD_ANGEL »

Hello @ all,i have 2 questions:

1. How can i set a name of an animation like CharacterNode.SetFrameLoop(320,360)
The reason for that is, that i want to check inn whick animation my CharacterNode is.

2. When i am using an MD2-Mesh with animations,i can start an animation with CharacterNode.setMD2Animation(MD2AnimationType.RUN).

Could i check in whick animtion my character is.

Something like this:

CharacterNode.getAnimation();//return RUN



Thx for Help


Note: I am using Irrlicht.net
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I dont think you can get/set the name of an animation. But you could set something up yourself. You could have a method which tells you by checking the current frame number, which you do have access to, and then checking in which range of frames it lies in to tell you which animation it is. So if the frame number was 340 say, then the method would say it was doing the run animation.

Why do you want this btw? Have you seen the AnimationEndCallBack? Might that help you?
Image Image Image
BAD_ANGEL
Posts: 5
Joined: Thu Nov 09, 2006 7:39 pm
Location: Germany

Post by BAD_ANGEL »

my problem is,when i am pressing my key for moving forward i starting die animation RUN,but when i keep the key pressed the animation starts again....i want start the animation if the key is pressed and the animtion hasn`t start.I think thats a good way that the animation not starts again and again.


Have other ideas?!

Thx
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Just keep a bool variable as to whether your character is walking. First time you get the key press it will find the bool to be false as the character isnt walking so it sets the bool to true and starts the animation. If it then detects the press again it checks the bool and finds it true as the character is still walking and so it then wont start the walking animation.
Image Image Image
BAD_ANGEL
Posts: 5
Joined: Thu Nov 09, 2006 7:39 pm
Location: Germany

Post by BAD_ANGEL »

ok THX,if i'm honest that the way i have it now.i give the var. false agian when i am releasing the key,thats right, isn't it???


i thought there is a better way for that problem. :cry:
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yeah it sounds about right, not sure why you'd want any different method! If it works then it's good hehe (within reason!)
Image Image Image
BAD_ANGEL
Posts: 5
Joined: Thu Nov 09, 2006 7:39 pm
Location: Germany

Post by BAD_ANGEL »

I think i will write a checking-method.....good idea,the code will looking more compact then,i think so!?

JP,THX helping so fast

cu
Post Reply