My questions are:
1. Is there a reliable way to import 3D animations from Blender to Irrlicht? If so, how?
2. If not, what would the community recommend as the best tool for creating animated 3D models for import into Irrlicht? The reason I like Blender is that it is free, well documented, and runs on Linux, so the more of these that apply to a tool the more interested I am.
Just to give some background on what I am trying to do, I downloaded the example files sydney.md2 and sydney.bmp, and tried them using the code below which I copied from a tutorial, and it worked. Next, I tried creating a moving cube in blender, exporting it in various formats, and using the file in place of sydney.md2. The cube appeared, but was static and didn't move.
Again, thanks so much for any help/advice!
Code: Select all
/*
* irrlichttest.cpp
*/
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
return 1;
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 renderer!",
rect<s32>(10,10,260,22), true);
IAnimatedMesh* mesh = smgr->getMesh("sydney.md2");
if (!mesh)
{
device->drop();
return 1;
}
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMD2Animation(scene::EMAT_STAND);
node->setMaterialTexture( 0, driver->getTexture("sydney.bmp") );
}
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}