change model animation

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.
VeneX
Posts: 228
Joined: Sun Nov 30, 2003 3:32 pm
Location: The Netherlands
Contact:

Post by VeneX »

Thanks for your help, but :oops: ...
She does take a step (as was), and a step again... But before she could finish her step she began to shake again.
Visit my website @ www.venex.be
Plethora project will be added to the site
AMD AthlonXP 2600+, 512MB DDR, Radeon M10 (mobile 9600) PRO 64MB, WinXP
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

please post your latest code
a screen cap is worth 0x100000 DWORDS
VeneX
Posts: 228
Joined: Sun Nov 30, 2003 3:32 pm
Location: The Netherlands
Contact:

Post by VeneX »

My code is now:

Code: Select all

#include <irrlicht.h> 
using namespace irr; 
using namespace core; 
using namespace scene; 
using namespace video; 
using namespace io; 
using namespace gui; 
#pragma comment(lib, "Irrlicht.lib") 

IAnimatedMeshSceneNode* node = 0;
IrrlichtDevice* device=0;

int main() 
{ 
	class MyEventReceiver : public IEventReceiver 
	{ 
	public: 

		virtual bool OnEvent(SEvent event) 
		{ 
		static bool model_anim = false;
		if (event.EventType == EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown && !model_anim) 
		{ 
            switch(event.KeyInput.Key) 
			{ 
				case KEY_KEY_W:
					{
						node->setMD2Animation(irr::scene::EMAT_RUN); 
						model_anim = true;
					}
				case KEY_ESCAPE:
					{
						device->closeDevice();
					}
				default:
					{
						node->setMD2Animation(irr::scene::EMAT_STAND);
						model_anim = false;
					}
			}
		 }
		 	
			if(event.EventType == EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN )
			{
				 node->setMD2Animation(irr::scene::EMAT_SALUTE);
				model_anim = false;
			}
			return false;
		}
		 
	};
				

   MyEventReceiver receiver;

   IrrlichtDevice *device = 
   createDevice(DT_SOFTWARE, dimension2d<s32>(512, 384), 16, false, false, &receiver); 

   device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo"); 

   IVideoDriver* driver = device->getVideoDriver(); 
   ISceneManager* smgr = device->getSceneManager(); 
   IGUIEnvironment* guienv = device->getGUIEnvironment(); 

   guienv->addStaticText(L"Hello World! This is the Irrlicht Software engine!", 
      true, rect<int>(10,10,200,30)); 

   IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2"); 
   node = smgr->addAnimatedMeshSceneNode( mesh ); 

   if (node) 
   { 
      node->setMaterialFlag(EMF_LIGHTING, false); 
      node->setFrameLoop(0, 310);    
      node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") ); 
   } 

   smgr->addCameraSceneNode(0, vector3df(0,10,-40), vector3df(0,0,0)); 

   while(device->run()) 
   { 
      driver->beginScene(true, true, SColor(0,100,100,100)); 

      smgr->drawAll(); 
      guienv->drawAll(); 

      driver->endScene(); 
   } 

   device->drop(); 

   return 0; 
}
The mouse works fine :D at puching W the program crashes, I think default is wrong.
Visit my website @ www.venex.be
Plethora project will be added to the site
AMD AthlonXP 2600+, 512MB DDR, Radeon M10 (mobile 9600) PRO 64MB, WinXP
Post Reply