How to set an MD2 animation when...

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
Anteater
Posts: 266
Joined: Thu Jun 01, 2006 4:02 pm
Location: Earth
Contact:

How to set an MD2 animation when...

Post by Anteater »

Hi. I'm trying to set the MD2 animation of an AnimatedMeshSceneNode, however it's being returned as a regular scene node (see below). However, this is causing a compile error when said node's MD2 animation is set because it's not returned as animated. Is there any workaround? I'm using non-SVN Irrlicht 1.1.

Code: Select all

for(nowid = 256; nowid < enid; nowid++)
     {
            
            ISceneNode* nowNode = smgr->getSceneNodeFromId(nowid);
            if (nowNode->isVisible() == true)
            {
               
				   vector3df campos1 = lex->getPosition();
                    vector3df pos = nowNode->getPosition();
                   vector3df rot = nowNode->getRotation();
                   f32 rotrad = rot.Y * PI / 180;  
                   pos.Z += delta * 0.2f * cos(rotrad);
                   pos.X += delta * 0.2f * sin(rotrad);
                   nowNode->setPosition(pos);
                   nowNode->setRotation(rot);
               
               
				   if(pos.getDistanceFrom(lex->getPosition()) < 64)
               {
				   
				   
                             //this is the line of code that doesn't work:

                             nowNode->setMD2Animation("attack");
                             

hp = hp - (0.01 * delta);
							 mhp = mhp + (0.0001 * delta);
                             
               }
               
r-type
Posts: 41
Joined: Sun Feb 12, 2006 1:54 am

Post by r-type »

just cast it to a IAnimatedMeshSceneNode
varnie
Posts: 31
Joined: Wed Jul 19, 2006 8:27 pm
Location: Russia, Ural

Post by varnie »

by the way...
why there's no getMD2Animation() method in Irrlicht in spite of a fact that there's setMD2Animation() one? i know, that it takes a few minutes to add currentAnimationState variable which will come in help when time has come to change node's current animation state. ( we don't want to change animation state on the same which is currently, right? that's the reason of all this discuss ).
but in any case i thought, why Irrlichht doesn't have getMD2Animation()?
just interesting..
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I would guess this is because setMD2Animation is ugliness to begin with, and adding getMD2Animation would mean breaking even more people's code when it's eventually removed! ;)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Image Image Image
Post Reply