noob problems

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
R@!D3N
Posts: 8
Joined: Thu Apr 29, 2010 4:59 pm

noob problems

Post by R@!D3N »

:x
i cant load any of my .3ds models or in fact i cant really load any of my models except .md2. . . .
and when i load the md2 model i cant animate it on key press. .. .like if i press w to run i cant make it run. . .

Code: Select all

if(keys[KEY_KEY_W]) 
	{
		node->setMD2Animation(scene::EMAT_RUN);
		node->setPosition(node->getPosition()+vector3df(0,0,0.1));
		
	}
i tried this. . .i loaded one of the pre made model. . the ones you get with the examples. . .please any quick usefull help would be nice em working on a project nd need fast help. . . only usefull comments please. . .i searched a lot but didnt get any solution. . . thnx in advance. . :?
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

i cant load any of my .3ds models or in fact i cant really load any of my models except .md2
Could be a problem with your path or maybe your exporter is not working correctly.
Code:
if(keys[KEY_KEY_W])
{
node->setMD2Animation(scene::EMAT_RUN);
node->setPosition(node->getPosition()+vector3df(0,0,0.1));

}
Maybe the animation speed is too slow. Try changing it. Also it is probably not a good idea to restart the animation everytime you press the key if you are trying to make your character run because the animation will never actually play. It will just keep restarting.
multum in parvo
R@!D3N
Posts: 8
Joined: Thu Apr 29, 2010 4:59 pm

Post by R@!D3N »

Maybe the animation speed is too slow. Try changing it.
the animation runs fine its just that when i press w it starts the animation and keeps playing the animation even when i let go of w, it doesnt stop . . . .
:( :?
and if i press w again and hold on to it, it stops the animation and the model just slides up . . . :?
you get wat em tryin to say ??? :?

any help on how i could make the animation run AND move the model only at key press???

further help would really b nice. . .
Could be a problem with your path or maybe your exporter is not working correctly.
the path is fine. . .i think its the exporter. . .but i downloaded some other models of the net, it didnt pick those up either. . . :? :?
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

first u need to understand what setAnimation is.
SetAnimation is not about it plays an animation when u calling it, and when u stop calling it, it stops.
No, it sets up that from which frame, to which frame should it play the animation.
So if u want to make ur character run when u press W, and stand when u not pressing anything, then u have to call the setAnimation(EMAT_RUN) when u press the W, and else, set it to EMAT_STAND.

Also setAnimation works like, sets the first, and the end frame, and sets the current frame to the start frame. So if u keep calling setAnimation in every loop, it will always move to the start frame, so it wont move.

for avoid that, u can make 2 variables, one for the previous animation, one for the next animation. Set the next animation to stand in every frame, and if pressed W then set to run, etc.
Then at the end, check if the last animation is different from the next animation, and if it is, then set the animation.
Or handle the events well (like if W is pressed, but not running yet, then run, and if nothing pressed but still not standing, then set stand, etc. but i think its much more complicated)
Image
Image
Post Reply